[postgis-users] Very slow with geometries having thousands of points

Tuan Pham Anh tuanpa at vngeobiz.com
Fri Jul 30 05:14:44 PDT 2004


Hello PostGIS users,

I'm new to PostGIS and this is my first problem, and I hope you can help
me.

I have a geo table in PostgreSQL with 8 records, but each record
contains  some polygons with thousands of points.

So in my test application in Java, I do the following code :


String _strDriver = "org.postgresql.Driver";
String _strDatabaseURL = "jdbc:postgresql://localhost:5432/mydb";
String _strUserName = "tuanpa";
String _strPassword = "";
String _strSQL = "select geom from tbl_regions";

Class.forName(_strDriver);
Connection conn = DriverManager.getConnection(_strDatabaseURL,
_strUserName, _strPassword);
Statement s = conn.createStatement();
ResultSet r = s.executeQuery(_strSQL);

while (r.next()) {
  // Do nothing here.
}

r.close();
s.close();
conn.close();

--------------

OK, it's quite simple.

So my question are:

1. I don't know why it take too much resources. In my computer, Celeron
1.7, 512 MB RAM, It takes 4 seconds and 100% process.
I use Window XP, PostgreSQL version 7.4.

2. I have read somewhere said that PostgreSQL doesn't get good
performance on Window box. So I love to hear how the performance is on
Linux box.
I have upload the scripts to create table and insert data at:
http://www.vngeobiz.com/temp/script.zip


Thanks,

------------------------------------------
Pham Anh Tuan
R&D Officer
Geobiz - GIS Technology Solutions.
Website: http://www.vngeobiz.com/
Email: tuanpa at vngeobiz.com






More information about the postgis-users mailing list