mirror of https://github.com/citusdata/citus.git
Prevent generating index-only "Path"s for columnar tables
Previously, even when `EXPLAIN` output tells that we will do index-only scan, it was never the case since columnar tables don't have the visibility fork that postgres is looking for. For this reason, visibility check done in `IndexOnlyNext->VM_ALL_VISIBLE` code-path was always returning false and postgres was reading the tuple from the columnar relation itself.pull/5246/head
parent
cc49e63222
commit
be3914ae28
|
@ -344,6 +344,13 @@ ColumnarGetRelationInfoHook(PlannerInfo *root, Oid relationObjectId,
|
|||
{
|
||||
/* disable parallel query */
|
||||
rel->rel_parallel_workers = 0;
|
||||
|
||||
/* disable index-only scan */
|
||||
IndexOptInfo *indexOptInfo = NULL;
|
||||
foreach_ptr(indexOptInfo, rel->indexlist)
|
||||
{
|
||||
memset(indexOptInfo->canreturn, false, indexOptInfo->ncolumns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM columnar_table WHERE a=6456;
|
|||
EXPLAIN (COSTS OFF) SELECT a FROM columnar_table WHERE a=6456;
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------
|
||||
Index Only Scan using columnar_table_a_idx on columnar_table
|
||||
Index Scan using columnar_table_a_idx on columnar_table
|
||||
Index Cond: (a = 6456)
|
||||
(2 rows)
|
||||
|
||||
|
@ -185,7 +185,7 @@ EXPLAIN (COSTS OFF) SELECT b FROM columnar_table WHERE b = 30000;
|
|||
EXPLAIN (COSTS OFF) SELECT b FROM columnar_table WHERE b = 30001;
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------
|
||||
Index Only Scan using columnar_table_b_idx on columnar_table
|
||||
Index Scan using columnar_table_b_idx on columnar_table
|
||||
Index Cond: (b = 30001)
|
||||
(2 rows)
|
||||
|
||||
|
@ -345,7 +345,7 @@ DROP INDEX unique_a;
|
|||
EXPLAIN (COSTS OFF) SELECT b FROM include_test WHERE a = 500;
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------
|
||||
Index Only Scan using unique_a_include_b_c_d on include_test
|
||||
Index Scan using unique_a_include_b_c_d on include_test
|
||||
Index Cond: (a = 500)
|
||||
(2 rows)
|
||||
|
||||
|
|
|
@ -354,7 +354,7 @@ LIMIT 100;
|
|||
-> GroupAggregate
|
||||
Group Key: full_correlated_1.a
|
||||
Filter: (count(DISTINCT full_correlated_1.a) >= 1)
|
||||
-> Index Only Scan Backward using full_correlated_btree on full_correlated full_correlated_1
|
||||
-> Index Scan Backward using full_correlated_btree on full_correlated full_correlated_1
|
||||
Index Cond: (a > 10)
|
||||
-> Materialize
|
||||
-> Subquery Scan on sub_3
|
||||
|
@ -612,10 +612,9 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
|
|||
SELECT * FROM uncorrelated WHERE x = 78910;
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------
|
||||
Index Only Scan using uncorrelated_idx on uncorrelated (actual rows=1 loops=1)
|
||||
Index Scan using uncorrelated_idx on uncorrelated (actual rows=1 loops=1)
|
||||
Index Cond: (x = 78910)
|
||||
Heap Fetches: 1
|
||||
(3 rows)
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM uncorrelated WHERE x = 78910;
|
||||
x
|
||||
|
|
Loading…
Reference in New Issue