[gdal-dev] Re: Optimizing random access in SQL result set of OGR DB drivers

Frank Warmerdam warmerdam at pobox.com
Wed Aug 26 18:02:01 EDT 2009

Even Rouault wrote:
> Martin,
> I take the liberty to CC the list, as it is an interesting issue and it's better
> to go public if we want to make progress on that.
> In a few words, this is about how we could speed up GetFeature() on the layers
> returned when issuing a SQL request on OGR drivers that rely on databases : PG
> driver, MySQL driver, SQLite driver (... ?). For people wanting to take part,
> you might be interested in the below email exchange first.
> After examining Martin's patches and reading its explanations, I cann see 2
> possibilities if we want to implement such optimization :


I haven't seen Martin's patches, but the normal way to provide indexed
access to resultsets is the OGRLayer::SetNextByIndex() method.  You
pass the index into the current result set and then GetNextFeature()
should read the indicated feature.

Currently only very few providers implement this in a customized way,
but it seems it would be better to expand that rather than introduce
a new mechanism.

Does this make sense?

PS. there are reasonably good reasons why we want the FID to be the
primary key where practical.  I would hate to break that.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list