Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62097a4

Browse files
committed
Fix selectivity estimation @> (anymultirange, anyrange) operator
Attempt to get selectivity estimation for @> (anymultirange, anyrange) operatorcaused an error in buildfarm, because this operator was missed in switch()of calc_hist_selectivity(). Fix that and also make regression tests reliablycheck that selectivity estimation for (multi)ranges doesn't fall. Previously,whether we test selectivity estimation for (multi)ranges depended onwhether autovacuum managed to gather concurrently to the test.Reported-by: Michael PaquierDiscussion:https://postgr.es/m/X%2BwmgjRItuvHNBeV%40paquier.xyz
1 parent860fe27 commit62097a4

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

‎src/backend/utils/adt/multirangetypes_selfuncs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
649649

650650
caseOID_MULTIRANGE_RANGE_CONTAINED_OP:
651651
caseOID_MULTIRANGE_MULTIRANGE_CONTAINED_OP:
652+
caseOID_RANGE_MULTIRANGE_CONTAINED_OP:
652653
if (const_lower.infinite)
653654
{
654655
/*

‎src/test/regress/expected/multirangetypes.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,6 +2227,11 @@ insert into test_multirange_gist select int4multirange(int4range(g, g+10000)) fr
22272227
insert into test_multirange_gist select int4multirange(int4range(NULL, g*10, '(]'), int4range(g*10, g*20, '(]')) from generate_series(1,100) g;
22282228
insert into test_multirange_gist select int4multirange(int4range(g*10, g*20, '(]'), int4range(g*20, NULL, '(]')) from generate_series(1,100) g;
22292229
create index test_mulrirange_gist_idx on test_multirange_gist using gist (mr);
2230+
-- test statistics and selectivity estimation as well
2231+
--
2232+
-- We don't check the accuracy of selectivity estimation, but at least check
2233+
-- it doesn't fall.
2234+
analyze test_multirange_gist;
22302235
-- first, verify non-indexed results
22312236
SET enable_seqscan = t;
22322237
SET enable_indexscan = f;

‎src/test/regress/expected/rangetypes.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,11 @@ insert into test_range_gist select 'empty'::int4range from generate_series(1,500
792792
insert into test_range_gist select int4range(NULL,g*10,'(]') from generate_series(1,100) g;
793793
insert into test_range_gist select int4range(g*10,NULL,'(]') from generate_series(1,100) g;
794794
insert into test_range_gist select int4range(g, g+10) from generate_series(1,2000) g;
795+
-- test statistics and selectivity estimation as well
796+
--
797+
-- We don't check the accuracy of selectivity estimation, but at least check
798+
-- it doesn't fall.
799+
analyze test_range_gist;
795800
-- first, verify non-indexed results
796801
SET enable_seqscan = t;
797802
SET enable_indexscan = f;

‎src/test/regress/sql/multirangetypes.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ insert into test_multirange_gist select int4multirange(int4range(NULL, g*10, '(]
423423
insert into test_multirange_gistselect int4multirange(int4range(g*10, g*20,'(]'), int4range(g*20,NULL,'(]'))from generate_series(1,100) g;
424424
createindextest_mulrirange_gist_idxon test_multirange_gist using gist (mr);
425425

426+
-- test statistics and selectivity estimation as well
427+
--
428+
-- We don't check the accuracy of selectivity estimation, but at least check
429+
-- it doesn't fall.
430+
analyze test_multirange_gist;
431+
426432
-- first, verify non-indexed results
427433
SET enable_seqscan= t;
428434
SET enable_indexscan= f;

‎src/test/regress/sql/rangetypes.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ insert into test_range_gist select int4range(NULL,g*10,'(]') from generate_serie
216216
insert into test_range_gistselect int4range(g*10,NULL,'(]')from generate_series(1,100) g;
217217
insert into test_range_gistselect int4range(g, g+10)from generate_series(1,2000) g;
218218

219+
-- test statistics and selectivity estimation as well
220+
--
221+
-- We don't check the accuracy of selectivity estimation, but at least check
222+
-- it doesn't fall.
223+
analyze test_range_gist;
224+
219225
-- first, verify non-indexed results
220226
SET enable_seqscan= t;
221227
SET enable_indexscan= f;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp