I've found significal performance problems when using large datasets along with the OGR VRT driver. To limit the number of the data to be retrieved I'd use a spatialfilter and the vrt connection string looks something like:
<OGRVRTDataSource><OGRVRTLayer name="mylayer"><SrcDataSource?>ODBC:gisdata,mylayer</SrcDataSource><SrcLayer?>mylayer</SrcLayer><GeometryType?>wkbPoint</GeometryType><GeometryField? encoding="PointFromColumns?" useSpatialSubquery="TRUE" x="lon27" y="lat27"/></OGRVRTLayer></OGRVRTDataSource>
However when the filter geometry is not a rectangle the filter won't be applied.
I consider this as a problem, since at least the bbox of the filter geometry should be used to limit the number of the records to be retrieved and the following patch should be applied:
Index: ogrvrtlayer.cpp
===================================================================
--- ogrvrtlayer.cpp (revision 13472)
+++ ogrvrtlayer.cpp (working copy)
@@ -451,7 +451,7 @@
/* Do we want to let source layer do spatial restriction? */
/* -------------------------------------------------------------------- */
char *pszFilter = NULL;
- if( m_poFilterGeom && m_bFilterIsEnvelope && bUseSpatialSubquery )
+ if( m_poFilterGeom && bUseSpatialSubquery && eGeometryType == VGS_PointFromColumns )
{
const char *pszXField, *pszYField;