[Gdal-dev] OGR VRT performance through ODBC...

Frank Warmerdam warmerdam at pobox.com
Sat Mar 17 19:43:41 EDT 2007

John Cole wrote:
> Frank,
>   Running ogrinfo takes more than 2 seconds to return a few rows (<10),
> though I'm not doing any precise timing.  I didn't see an option to print
> out any performance statistics.
> I was hoping there might be some tuning I could do on the ODBC driver to
> improve the speed.


OK, so we know it isn't something about MapServer.  The next thing I wonder
is how much is "connection cost".  You can likely establish this by just
doing ogrinfo on your .vrt without any request for specific layers and their
features.  If that is also slow, then the ODBC connection cost is high.  This
isn't something you would see from the mssql sql shell since it is "paid"
once at connection time.

We should also ensure the issue isn't the VRT driver.  You can verify this
by doing something like:

  ogrinfo -ro ODBC:mapserver at HUDPLS -sql 'all your sql'

Hmm, thinking about it a bit, I suspect the problem is that when OGR connects
to an ODBC provider it tries to create layer information about all the layers
on that database.  If you have lots of tables, potentially even system tables,
that could be quite substantial.  The way around this is to list the specific
tables you wanted enumerated.  Since you are using an sql statement you don't
need any, but I think you need at least one.

Try using an ODBC connection string like:
   ODBC:mapserver at HUDPLS,<sometablename>

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    | President OSGeo, http://osgeo.org

More information about the Gdal-dev mailing list