Hi Alexandre, and thanks for the feedback I'm sorry but I don't understand the 2 solutions you advised.
Let's see if I can explain my case better. I am using SqlServer and I set up a test project including that view and a normal spatial table. Looking at the initialization queries in SQLServer profiler, I noticed that both entities run the same queries. But if the spatial_index_tessellations lookup query returns no data, then QGIS tries to retrieve the extent with a full table scan. In order the queries are: 1) get the computed columns (almost useless for me) SELECT name FROM sys.columns WHERE is_computed = 1 AND object_id = xxx 2) get columns metadata (in some cases useless for me) exec sp_columns @table_name = xxx 3) get table pks (useless for me) exec sp_pkeys @table_name = xxx 4) get extent from index SELECT min(bounding_box_xmin), min(bounding_box_ymin), max(bounding_box_xmax), max(bounding_box_ymax) FROM sys.spatial_index_tessellations WHERE object_id = xxx 5) if 4 returns no data, then compute the extent from full scan (2 queries) 5-1) Compute a binary checksum (????? and why 42?) select min([SHAPE].STPointN(1).STX), min([SHAPE].STPointN(1).STY), max([SHAPE].STPointN(1).STX), max([SHAPE].STPointN(1).STY), count(*) from xxx WHERE (ABS(CAST((BINARY_CHECKSUM([[OBJECTID]])) as int)) % 100) = 42 5-2) actually compute the extent from full scan select min([SHAPE].STPointN(1).STX), min([SHAPE].STPointN(1).STY), max([SHAPE].STPointN(1).STX), max([SHAPE].STPointN(1).STY), count(*) from xxx
_______________________________________________ Qgis-user mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
