[gdal-dev] ogr-pg: GetFeature() speed

Martin Landa landa.martin at gmail.com
Tue Aug 23 07:57:38 EDT 2011


Hi,

I have tested speed of random access to PostGIS features with simple
testing application.

    // about 1e4 points
    poLayer = poDS->GetLayerByName("bridges");

    nfeatures = poLayer->GetFeatureCount();

    for (int fid = 1; fid < nfeatures; fid++)
	poFeature = poLayer->GetFeature(fid);

and sequential access

    while(1) {
	poFeature = poLayer->GetNextFeature();
	if (!poFeature)
	    break;
    }

I would expect that random access will be slower, anyway not so much.

random access

real    0m5.612s
user    0m1.432s
sys     0m0.512s

sequential access

real    0m0.248s
user    0m0.116s
sys     0m0.012s

Are there any possibilities how to speed up random access (not
speaking about sample application where should be used seq access).

Thanks in advance, Martin

-- 
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa


More information about the gdal-dev mailing list