Here is an example which is direct copy from &&
documentation, ST_Intersects
adaptation:
# SELECT tbl1.column1, tbl2.column1, tbl1.column2 && tbl2.column2 AS overlaps
FROM ( VALUES
(1, 'LINESTRING(0 0, 3 3)'::geometry),
(2, 'LINESTRING(0 1, 0 5)'::geometry))t1.id AS tbl1t1,
( VALUES
(3, 'LINESTRING(1 2, 4 6)'::geometry)) AS tbl2;
column1 | column1 |t2.id overlapsAS
---------+---------+----------t2,
1 | t1.ln && 3t2.ln |AS t"&&",
2 | 3 | f
(2 rows)
Below is ST_Intersects
adaptation:
# SELECT tbl1.column1, tbl2.column1, ST_Intersects(tbl1t1.column2ln,tbl2t2.column2ln) AS overlaps
FROM ( VALUES
(1, 'LINESTRING(0 0, 3 3)'::geometry),
(2, 'LINESTRING(0 1, 0 5)'::geometry)
) AS tbl1t1(id,ln)
(CROSS JOIN (VALUES
(3, 'LINESTRING(1 2, 4 6)'::geometry)
) AS tbl2;t2(id,ln);
column1t1 | column1t2 | overlaps&& | st_intersects
-----+----+----+-----+----------
1 | 3 | t 3 | f
2 | 3 | f 3 | f
(2 rows)
To summarize:
Question 1 is if &&&&
is significantly faster than ST_IntersectsST_Intersects
when using with ST_MakeEnvelopeST_MakeEnvelope
(a rectangular boundary), when finding points inside a rectangular bounding box.
Question 2 is Also am I understanding correctly that when checking points inside a rectangular boundary &&&&
does exactly same thing as ST_IntersectsST_Intersects
?