mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Remove duplicative polygon SP-GiST sequencing test.
Code coverage comparisons confirm that the tests using quad_poly_tbl_ord_seq1/quad_poly_tbl_ord_idx1 hit no code paths not also covered by the similar tests using quad_poly_tbl_ord_seq2/quad_poly_tbl_ord_idx2. Since these test cases are pretty expensive, they need to contribute more than zero benefit. In passing, make quad_poly_tbl_ord_seq2 a temp table, since there seems little reason to keep it around after the test. Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us
This commit is contained in:
@ -66,10 +66,7 @@ CREATE INDEX quad_poly_tbl_idx ON quad_poly_tbl USING spgist(p);
|
|||||||
SET enable_seqscan = ON;
|
SET enable_seqscan = ON;
|
||||||
SET enable_indexscan = OFF;
|
SET enable_indexscan = OFF;
|
||||||
SET enable_bitmapscan = OFF;
|
SET enable_bitmapscan = OFF;
|
||||||
CREATE TABLE quad_poly_tbl_ord_seq1 AS
|
CREATE TEMP TABLE quad_poly_tbl_ord_seq2 AS
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
|
||||||
FROM quad_poly_tbl;
|
|
||||||
CREATE TABLE quad_poly_tbl_ord_seq2 AS
|
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
||||||
FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))';
|
FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))';
|
||||||
-- check results results from index scan
|
-- check results results from index scan
|
||||||
@ -283,28 +280,6 @@ SELECT count(*) FROM quad_poly_tbl WHERE p ~= polygon '((200, 300),(210, 310),(2
|
|||||||
-- test ORDER BY distance
|
-- test ORDER BY distance
|
||||||
SET enable_indexscan = ON;
|
SET enable_indexscan = ON;
|
||||||
SET enable_bitmapscan = OFF;
|
SET enable_bitmapscan = OFF;
|
||||||
EXPLAIN (COSTS OFF)
|
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
|
||||||
FROM quad_poly_tbl;
|
|
||||||
QUERY PLAN
|
|
||||||
-----------------------------------------------------------
|
|
||||||
WindowAgg
|
|
||||||
-> Index Scan using quad_poly_tbl_idx on quad_poly_tbl
|
|
||||||
Order By: (p <-> '(123,456)'::point)
|
|
||||||
(3 rows)
|
|
||||||
|
|
||||||
CREATE TEMP TABLE quad_poly_tbl_ord_idx1 AS
|
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
|
||||||
FROM quad_poly_tbl;
|
|
||||||
SELECT *
|
|
||||||
FROM quad_poly_tbl_ord_seq1 seq FULL JOIN quad_poly_tbl_ord_idx1 idx
|
|
||||||
ON seq.n = idx.n AND seq.id = idx.id AND
|
|
||||||
(seq.dist = idx.dist OR seq.dist IS NULL AND idx.dist IS NULL)
|
|
||||||
WHERE seq.id IS NULL OR idx.id IS NULL;
|
|
||||||
n | dist | id | n | dist | id
|
|
||||||
---+------+----+---+------+----
|
|
||||||
(0 rows)
|
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
||||||
FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))';
|
FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))';
|
||||||
|
@ -167,8 +167,6 @@ polygon_tbl|t
|
|||||||
quad_box_tbl|t
|
quad_box_tbl|t
|
||||||
quad_point_tbl|t
|
quad_point_tbl|t
|
||||||
quad_poly_tbl|t
|
quad_poly_tbl|t
|
||||||
quad_poly_tbl_ord_seq1|f
|
|
||||||
quad_poly_tbl_ord_seq2|f
|
|
||||||
radix_text_tbl|t
|
radix_text_tbl|t
|
||||||
ramp|f
|
ramp|f
|
||||||
real_city|f
|
real_city|f
|
||||||
|
@ -62,11 +62,7 @@ SET enable_seqscan = ON;
|
|||||||
SET enable_indexscan = OFF;
|
SET enable_indexscan = OFF;
|
||||||
SET enable_bitmapscan = OFF;
|
SET enable_bitmapscan = OFF;
|
||||||
|
|
||||||
CREATE TABLE quad_poly_tbl_ord_seq1 AS
|
CREATE TEMP TABLE quad_poly_tbl_ord_seq2 AS
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
|
||||||
FROM quad_poly_tbl;
|
|
||||||
|
|
||||||
CREATE TABLE quad_poly_tbl_ord_seq2 AS
|
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
||||||
FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))';
|
FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))';
|
||||||
|
|
||||||
@ -127,21 +123,6 @@ SELECT count(*) FROM quad_poly_tbl WHERE p ~= polygon '((200, 300),(210, 310),(2
|
|||||||
SET enable_indexscan = ON;
|
SET enable_indexscan = ON;
|
||||||
SET enable_bitmapscan = OFF;
|
SET enable_bitmapscan = OFF;
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF)
|
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
|
||||||
FROM quad_poly_tbl;
|
|
||||||
|
|
||||||
CREATE TEMP TABLE quad_poly_tbl_ord_idx1 AS
|
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
|
||||||
FROM quad_poly_tbl;
|
|
||||||
|
|
||||||
SELECT *
|
|
||||||
FROM quad_poly_tbl_ord_seq1 seq FULL JOIN quad_poly_tbl_ord_idx1 idx
|
|
||||||
ON seq.n = idx.n AND seq.id = idx.id AND
|
|
||||||
(seq.dist = idx.dist OR seq.dist IS NULL AND idx.dist IS NULL)
|
|
||||||
WHERE seq.id IS NULL OR idx.id IS NULL;
|
|
||||||
|
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id
|
||||||
FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))';
|
FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))';
|
||||||
|
Reference in New Issue
Block a user