speed-optimization
Not logged in

back to 4.1.0-doc

Speed optimizations introduced in 4.0.1-trunk

Many spatial operators has been substantially revised and are now more efficient than before.

Basically the introduced optimizations fall in two different areas:

Comparative benchmark

The following table reports timings measured on the same platform performing twice the same identical SQL query:
As you can easily notice, the actual efficiency of the introduced optimizations is rather variable and strongly affected be the specific query context:
Please note: all timings are reported in minutes and seconds

SQL Query not optimized
4.0.0
optimized
4.0.1-trunk
SELECT p.nome_pro, c.nome_com
FROM prov2011 AS p, com2011 AS c
WHERE ST_Contains(p.geometry, c.geometry) = 1
AND p.cod_reg = 9;
1:17 0:31
SELECT p.nome_pro, c.nome_com
FROM prov2011 AS p, com2011 AS c
WHERE ST_Within(c.geometry, p.geometry) = 1
AND p.cod_reg = 3;
1:02 0:24
SELECT p.nome_pro, c.nome_com
FROM prov2011 AS p, com2011 AS c
WHERE ST_Covers(p.geometry, c.geometry) = 1
AND p.cod_reg = 8;
0:56 0:23
SELECT p.nome_pro, c.nome_com
FROM prov2011 AS p, com2011 AS c
WHERE ST_CoveredBy(c.geometry, p.geometry) = 1
AND p.cod_reg = 15;
0:43 0:17
SELECT p.nome_pro, c.nome_com
FROM prov2011 AS p, com2011 AS c
WHERE ST_Contains(p.geometry, c.geometry) = 1 AND c.ROWID IN (
    SELECT ROWID
    FROM SpatialIndex
    WHERE f_table_name = 'com2011' AND search_frame = p.geometry
);
1:23 0:46
SELECT p.nome_pro, c.nome_com
FROM prov2011 AS p, com2011 AS c
WHERE ST_Within(c.geometry, p.geometry) = 1 AND c.ROWID IN (
    SELECT ROWID
    FROM SpatialIndex
    WHERE f_table_name = 'com2011' AND search_frame = p.geometry
);
1:23 0:46
SELECT p.nome_pro, c.nome_com
FROM prov2011 AS p, com2011 AS c
WHERE ST_Covers(p.geometry, c.geometry) = 1 AND c.ROWID IN (
    SELECT ROWID
    FROM SpatialIndex
    WHERE f_table_name = 'com2011' AND search_frame = p.geometry
);
1:23 0:46
SELECT p.nome_pro, c.nome_com
FROM prov2011 AS p, com2011 AS c
WHERE ST_CoveredBy(c.geometry, p.geometry) = 1 AND c.ROWID IN (
    SELECT ROWID
    FROM SpatialIndex
    WHERE f_table_name = 'com2011' AND search_frame = p.geometry
);
1:23 0:46
SELECT p1.nome_pro, p2.nome_pro
FROM prov2011 AS p1, prov2011 AS p2
WHERE ST_Touches(p1.geometry, p2.geometry) = 1;
0:56 0:43
SELECT p1.nome_pro, p2.nome_pro
FROM prov2011 AS p1, prov2011 AS p2
WHERE ST_Touches(p1.geometry, p2.geometry) = 1 AND p1.ROWID IN (
    SELECT ROWID
    FROM SpatialIndex
    WHERE f_table_name = 'prov2011' AND search_frame = p2.geometry
);
0:33 0:33
SELECT p1.nome_pro, p2.nome_pro
FROM prov2011 AS p1, prov2011 AS p2
WHERE ST_Equals(p1.geometry, p2.geometry) = 1;
0:40 0:27
SELECT p1.nome_pro, p2.nome_pro FROM prov2011 AS p1, prov2011 AS p2
WHERE ST_Equals(p1.geometry, p2.geometry) = 1 AND p1.ROWID IN (
    SELECT ROWID
    FROM SpatialIndex
    WHERE f_table_name = 'prov2011' AND search_frame = p2.geometry
);
0:17 0:16


back to 4.1.0-doc