mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Fix selectivity estimation @> (anymultirange, anyrange) operator
Attempt to get selectivity estimation for @> (anymultirange, anyrange) operator caused an error in buildfarm, because this operator was missed in switch() of calc_hist_selectivity(). Fix that and also make regression tests reliably check that selectivity estimation for (multi)ranges doesn't fall. Previously, whether we test selectivity estimation for (multi)ranges depended on whether autovacuum managed to gather concurrently to the test. Reported-by: Michael Paquier Discussion: https://postgr.es/m/X%2BwmgjRItuvHNBeV%40paquier.xyz
This commit is contained in:
parent
860fe27ee1
commit
62097a4cc8
@ -649,6 +649,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
|
||||
|
||||
case OID_MULTIRANGE_RANGE_CONTAINED_OP:
|
||||
case OID_MULTIRANGE_MULTIRANGE_CONTAINED_OP:
|
||||
case OID_RANGE_MULTIRANGE_CONTAINED_OP:
|
||||
if (const_lower.infinite)
|
||||
{
|
||||
/*
|
||||
|
@ -2227,6 +2227,11 @@ insert into test_multirange_gist select int4multirange(int4range(g, g+10000)) fr
|
||||
insert into test_multirange_gist select int4multirange(int4range(NULL, g*10, '(]'), int4range(g*10, g*20, '(]')) from generate_series(1,100) g;
|
||||
insert into test_multirange_gist select int4multirange(int4range(g*10, g*20, '(]'), int4range(g*20, NULL, '(]')) from generate_series(1,100) g;
|
||||
create index test_mulrirange_gist_idx on test_multirange_gist using gist (mr);
|
||||
-- test statistics and selectivity estimation as well
|
||||
--
|
||||
-- We don't check the accuracy of selectivity estimation, but at least check
|
||||
-- it doesn't fall.
|
||||
analyze test_multirange_gist;
|
||||
-- first, verify non-indexed results
|
||||
SET enable_seqscan = t;
|
||||
SET enable_indexscan = f;
|
||||
|
@ -792,6 +792,11 @@ insert into test_range_gist select 'empty'::int4range from generate_series(1,500
|
||||
insert into test_range_gist select int4range(NULL,g*10,'(]') from generate_series(1,100) g;
|
||||
insert into test_range_gist select int4range(g*10,NULL,'(]') from generate_series(1,100) g;
|
||||
insert into test_range_gist select int4range(g, g+10) from generate_series(1,2000) g;
|
||||
-- test statistics and selectivity estimation as well
|
||||
--
|
||||
-- We don't check the accuracy of selectivity estimation, but at least check
|
||||
-- it doesn't fall.
|
||||
analyze test_range_gist;
|
||||
-- first, verify non-indexed results
|
||||
SET enable_seqscan = t;
|
||||
SET enable_indexscan = f;
|
||||
|
@ -423,6 +423,12 @@ insert into test_multirange_gist select int4multirange(int4range(NULL, g*10, '(]
|
||||
insert into test_multirange_gist select int4multirange(int4range(g*10, g*20, '(]'), int4range(g*20, NULL, '(]')) from generate_series(1,100) g;
|
||||
create index test_mulrirange_gist_idx on test_multirange_gist using gist (mr);
|
||||
|
||||
-- test statistics and selectivity estimation as well
|
||||
--
|
||||
-- We don't check the accuracy of selectivity estimation, but at least check
|
||||
-- it doesn't fall.
|
||||
analyze test_multirange_gist;
|
||||
|
||||
-- first, verify non-indexed results
|
||||
SET enable_seqscan = t;
|
||||
SET enable_indexscan = f;
|
||||
|
@ -216,6 +216,12 @@ insert into test_range_gist select int4range(NULL,g*10,'(]') from generate_serie
|
||||
insert into test_range_gist select int4range(g*10,NULL,'(]') from generate_series(1,100) g;
|
||||
insert into test_range_gist select int4range(g, g+10) from generate_series(1,2000) g;
|
||||
|
||||
-- test statistics and selectivity estimation as well
|
||||
--
|
||||
-- We don't check the accuracy of selectivity estimation, but at least check
|
||||
-- it doesn't fall.
|
||||
analyze test_range_gist;
|
||||
|
||||
-- first, verify non-indexed results
|
||||
SET enable_seqscan = t;
|
||||
SET enable_indexscan = f;
|
||||
|
Loading…
x
Reference in New Issue
Block a user