mirror of https://github.com/citusdata/citus.git
Columnar: don't double count chunks filtered
parent
cbb95af2c2
commit
1d311b0709
|
@ -529,7 +529,7 @@ SelectedChunkMask(StripeSkipList *stripeSkipList, List *projectedColumnList,
|
||||||
#else
|
#else
|
||||||
predicateRefuted = predicate_refuted_by(constraintList, restrictInfoList);
|
predicateRefuted = predicate_refuted_by(constraintList, restrictInfoList);
|
||||||
#endif
|
#endif
|
||||||
if (predicateRefuted)
|
if (predicateRefuted && selectedChunkMask[chunkIndex])
|
||||||
{
|
{
|
||||||
selectedChunkMask[chunkIndex] = false;
|
selectedChunkMask[chunkIndex] = false;
|
||||||
*chunksFiltered += 1;
|
*chunksFiltered += 1;
|
||||||
|
|
|
@ -89,3 +89,15 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
SELECT * FROM simple_chunk_filtering WHERE i > 180000;
|
SELECT * FROM simple_chunk_filtering WHERE i > 180000;
|
||||||
|
|
||||||
DROP TABLE simple_chunk_filtering;
|
DROP TABLE simple_chunk_filtering;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE multi_column_chunk_filtering(a int, b int) USING columnar;
|
||||||
|
INSERT INTO multi_column_chunk_filtering SELECT i,i+1 FROM generate_series(0,234567) i;
|
||||||
|
|
||||||
|
EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
|
SELECT count(*) FROM multi_column_chunk_filtering WHERE a > 50000;
|
||||||
|
|
||||||
|
EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
|
SELECT count(*) FROM multi_column_chunk_filtering WHERE a > 50000 AND b > 50000;
|
||||||
|
|
||||||
|
DROP TABLE multi_column_chunk_filtering;
|
||||||
|
|
|
@ -157,3 +157,28 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
DROP TABLE simple_chunk_filtering;
|
DROP TABLE simple_chunk_filtering;
|
||||||
|
CREATE TABLE multi_column_chunk_filtering(a int, b int) USING columnar;
|
||||||
|
INSERT INTO multi_column_chunk_filtering SELECT i,i+1 FROM generate_series(0,234567) i;
|
||||||
|
EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
|
SELECT count(*) FROM multi_column_chunk_filtering WHERE a > 50000;
|
||||||
|
QUERY PLAN
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
Aggregate (actual rows=1 loops=1)
|
||||||
|
-> Custom Scan (ColumnarScan) on multi_column_chunk_filtering (actual rows=184567 loops=1)
|
||||||
|
Filter: (a > 50000)
|
||||||
|
Rows Removed by Filter: 1
|
||||||
|
Columnar Chunks Removed by Filter: 5
|
||||||
|
(5 rows)
|
||||||
|
|
||||||
|
EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
|
SELECT count(*) FROM multi_column_chunk_filtering WHERE a > 50000 AND b > 50000;
|
||||||
|
QUERY PLAN
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
Aggregate (actual rows=1 loops=1)
|
||||||
|
-> Custom Scan (ColumnarScan) on multi_column_chunk_filtering (actual rows=184567 loops=1)
|
||||||
|
Filter: ((a > 50000) AND (b > 50000))
|
||||||
|
Rows Removed by Filter: 1
|
||||||
|
Columnar Chunks Removed by Filter: 5
|
||||||
|
(5 rows)
|
||||||
|
|
||||||
|
DROP TABLE multi_column_chunk_filtering;
|
||||||
|
|
Loading…
Reference in New Issue