mirror of https://github.com/citusdata/citus.git
Use 'Chunk Groups' in EXPLAIN ANALYZE of columnar scan
parent
1d311b0709
commit
0a9fd91d8f
|
@ -490,9 +490,9 @@ ColumnarScan_ExplainCustomScan(CustomScanState *node, List *ancestors,
|
||||||
|
|
||||||
if (scanDesc != NULL)
|
if (scanDesc != NULL)
|
||||||
{
|
{
|
||||||
int64 chunksFiltered = ColumnarGetChunksFiltered(scanDesc);
|
int64 chunkGroupsFiltered = ColumnarGetChunkGroupsFiltered(scanDesc);
|
||||||
ExplainPropertyInteger("Columnar Chunks Removed by Filter", NULL,
|
ExplainPropertyInteger("Columnar Chunk Groups Removed by Filter", NULL,
|
||||||
chunksFiltered, es);
|
chunkGroupsFiltered, es);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ static StripeBuffers * LoadFilteredStripeBuffers(Relation relation,
|
||||||
TupleDesc tupleDescriptor,
|
TupleDesc tupleDescriptor,
|
||||||
List *projectedColumnList,
|
List *projectedColumnList,
|
||||||
List *whereClauseList,
|
List *whereClauseList,
|
||||||
int64 *chunksFiltered);
|
int64 *chunkGroupsFiltered);
|
||||||
static void ReadStripeNextRow(StripeBuffers *stripeBuffers, List *projectedColumnList,
|
static void ReadStripeNextRow(StripeBuffers *stripeBuffers, List *projectedColumnList,
|
||||||
uint64 chunkIndex, uint64 chunkRowIndex,
|
uint64 chunkIndex, uint64 chunkRowIndex,
|
||||||
ChunkData *chunkData, Datum *columnValues,
|
ChunkData *chunkData, Datum *columnValues,
|
||||||
|
@ -56,7 +56,7 @@ static ColumnBuffers * LoadColumnBuffers(Relation relation,
|
||||||
Form_pg_attribute attributeForm);
|
Form_pg_attribute attributeForm);
|
||||||
static bool * SelectedChunkMask(StripeSkipList *stripeSkipList,
|
static bool * SelectedChunkMask(StripeSkipList *stripeSkipList,
|
||||||
List *projectedColumnList, List *whereClauseList,
|
List *projectedColumnList, List *whereClauseList,
|
||||||
int64 *chunksFiltered);
|
int64 *chunkGroupsFiltered);
|
||||||
static List * BuildRestrictInfoList(List *whereClauseList);
|
static List * BuildRestrictInfoList(List *whereClauseList);
|
||||||
static Node * BuildBaseConstraint(Var *variable);
|
static Node * BuildBaseConstraint(Var *variable);
|
||||||
static OpExpr * MakeOpExpression(Var *variable, int16 strategyNumber);
|
static OpExpr * MakeOpExpression(Var *variable, int16 strategyNumber);
|
||||||
|
@ -106,7 +106,7 @@ ColumnarBeginRead(Relation relation, TupleDesc tupleDescriptor,
|
||||||
readState->stripeBuffers = NULL;
|
readState->stripeBuffers = NULL;
|
||||||
readState->readStripeCount = 0;
|
readState->readStripeCount = 0;
|
||||||
readState->stripeReadRowCount = 0;
|
readState->stripeReadRowCount = 0;
|
||||||
readState->chunksFiltered = 0;
|
readState->chunkGroupsFiltered = 0;
|
||||||
readState->tupleDescriptor = tupleDescriptor;
|
readState->tupleDescriptor = tupleDescriptor;
|
||||||
readState->stripeReadContext = stripeReadContext;
|
readState->stripeReadContext = stripeReadContext;
|
||||||
readState->chunkData = NULL;
|
readState->chunkData = NULL;
|
||||||
|
@ -158,7 +158,7 @@ ColumnarReadNextRow(TableReadState *readState, Datum *columnValues, bool *column
|
||||||
readState->
|
readState->
|
||||||
whereClauseList,
|
whereClauseList,
|
||||||
&readState->
|
&readState->
|
||||||
chunksFiltered);
|
chunkGroupsFiltered);
|
||||||
readState->readStripeCount++;
|
readState->readStripeCount++;
|
||||||
readState->currentStripeMetadata = stripeMetadata;
|
readState->currentStripeMetadata = stripeMetadata;
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ ColumnarTableRowCount(Relation relation)
|
||||||
static StripeBuffers *
|
static StripeBuffers *
|
||||||
LoadFilteredStripeBuffers(Relation relation, StripeMetadata *stripeMetadata,
|
LoadFilteredStripeBuffers(Relation relation, StripeMetadata *stripeMetadata,
|
||||||
TupleDesc tupleDescriptor, List *projectedColumnList,
|
TupleDesc tupleDescriptor, List *projectedColumnList,
|
||||||
List *whereClauseList, int64 *chunksFiltered)
|
List *whereClauseList, int64 *chunkGroupsFiltered)
|
||||||
{
|
{
|
||||||
uint32 columnIndex = 0;
|
uint32 columnIndex = 0;
|
||||||
uint32 columnCount = tupleDescriptor->natts;
|
uint32 columnCount = tupleDescriptor->natts;
|
||||||
|
@ -340,7 +340,7 @@ LoadFilteredStripeBuffers(Relation relation, StripeMetadata *stripeMetadata,
|
||||||
stripeMetadata->chunkCount);
|
stripeMetadata->chunkCount);
|
||||||
|
|
||||||
bool *selectedChunkMask = SelectedChunkMask(stripeSkipList, projectedColumnList,
|
bool *selectedChunkMask = SelectedChunkMask(stripeSkipList, projectedColumnList,
|
||||||
whereClauseList, chunksFiltered);
|
whereClauseList, chunkGroupsFiltered);
|
||||||
|
|
||||||
StripeSkipList *selectedChunkSkipList =
|
StripeSkipList *selectedChunkSkipList =
|
||||||
SelectedChunkSkipList(stripeSkipList, projectedColumnMask,
|
SelectedChunkSkipList(stripeSkipList, projectedColumnMask,
|
||||||
|
@ -479,7 +479,7 @@ LoadColumnBuffers(Relation relation, ColumnChunkSkipNode *chunkSkipNodeArray,
|
||||||
*/
|
*/
|
||||||
static bool *
|
static bool *
|
||||||
SelectedChunkMask(StripeSkipList *stripeSkipList, List *projectedColumnList,
|
SelectedChunkMask(StripeSkipList *stripeSkipList, List *projectedColumnList,
|
||||||
List *whereClauseList, int64 *chunksFiltered)
|
List *whereClauseList, int64 *chunkGroupsFiltered)
|
||||||
{
|
{
|
||||||
ListCell *columnCell = NULL;
|
ListCell *columnCell = NULL;
|
||||||
uint32 chunkIndex = 0;
|
uint32 chunkIndex = 0;
|
||||||
|
@ -532,7 +532,7 @@ SelectedChunkMask(StripeSkipList *stripeSkipList, List *projectedColumnList,
|
||||||
if (predicateRefuted && selectedChunkMask[chunkIndex])
|
if (predicateRefuted && selectedChunkMask[chunkIndex])
|
||||||
{
|
{
|
||||||
selectedChunkMask[chunkIndex] = false;
|
selectedChunkMask[chunkIndex] = false;
|
||||||
*chunksFiltered += 1;
|
*chunkGroupsFiltered += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1158,7 +1158,7 @@ columnar_tableam_finish()
|
||||||
* Get the number of chunks filtered out during the given scan.
|
* Get the number of chunks filtered out during the given scan.
|
||||||
*/
|
*/
|
||||||
int64
|
int64
|
||||||
ColumnarGetChunksFiltered(TableScanDesc scanDesc)
|
ColumnarGetChunkGroupsFiltered(TableScanDesc scanDesc)
|
||||||
{
|
{
|
||||||
ColumnarScanDesc columnarScanDesc = (ColumnarScanDesc) scanDesc;
|
ColumnarScanDesc columnarScanDesc = (ColumnarScanDesc) scanDesc;
|
||||||
TableReadState *readState = columnarScanDesc->cs_readState;
|
TableReadState *readState = columnarScanDesc->cs_readState;
|
||||||
|
@ -1166,7 +1166,7 @@ ColumnarGetChunksFiltered(TableScanDesc scanDesc)
|
||||||
/* readState is initialized lazily */
|
/* readState is initialized lazily */
|
||||||
if (readState != NULL)
|
if (readState != NULL)
|
||||||
{
|
{
|
||||||
return readState->chunksFiltered;
|
return readState->chunkGroupsFiltered;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -232,7 +232,7 @@ typedef struct TableReadState
|
||||||
StripeBuffers *stripeBuffers;
|
StripeBuffers *stripeBuffers;
|
||||||
uint32 readStripeCount;
|
uint32 readStripeCount;
|
||||||
uint64 stripeReadRowCount;
|
uint64 stripeReadRowCount;
|
||||||
int64 chunksFiltered;
|
int64 chunkGroupsFiltered;
|
||||||
ChunkData *chunkData;
|
ChunkData *chunkData;
|
||||||
int32 deserializedChunkIndex;
|
int32 deserializedChunkIndex;
|
||||||
} TableReadState;
|
} TableReadState;
|
||||||
|
|
|
@ -18,7 +18,7 @@ extern TableScanDesc columnar_beginscan_extended(Relation relation, Snapshot sna
|
||||||
ParallelTableScanDesc parallel_scan,
|
ParallelTableScanDesc parallel_scan,
|
||||||
uint32 flags, Bitmapset *attr_needed,
|
uint32 flags, Bitmapset *attr_needed,
|
||||||
List *scanQual);
|
List *scanQual);
|
||||||
extern int64 ColumnarGetChunksFiltered(TableScanDesc scanDesc);
|
extern int64 ColumnarGetChunkGroupsFiltered(TableScanDesc scanDesc);
|
||||||
extern bool IsColumnarTableAmTable(Oid relationId);
|
extern bool IsColumnarTableAmTable(Oid relationId);
|
||||||
extern TableDDLCommand * ColumnarGetTableOptionsDDL(Oid relationId);
|
extern TableDDLCommand * ColumnarGetTableOptionsDDL(Oid relationId);
|
||||||
extern char * GetShardedTableDDLCommandColumnar(uint64 shardId, void *context);
|
extern char * GetShardedTableDDLCommandColumnar(uint64 shardId, void *context);
|
||||||
|
|
|
@ -127,7 +127,7 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
Custom Scan (ColumnarScan) on simple_chunk_filtering (actual rows=111111 loops=1)
|
Custom Scan (ColumnarScan) on simple_chunk_filtering (actual rows=111111 loops=1)
|
||||||
Filter: (i > 123456)
|
Filter: (i > 123456)
|
||||||
Rows Removed by Filter: 3457
|
Rows Removed by Filter: 3457
|
||||||
Columnar Chunks Removed by Filter: 12
|
Columnar Chunk Groups Removed by Filter: 12
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
SET columnar.enable_qual_pushdown = false;
|
SET columnar.enable_qual_pushdown = false;
|
||||||
|
@ -138,7 +138,7 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
Custom Scan (ColumnarScan) on simple_chunk_filtering (actual rows=111111 loops=1)
|
Custom Scan (ColumnarScan) on simple_chunk_filtering (actual rows=111111 loops=1)
|
||||||
Filter: (i > 123456)
|
Filter: (i > 123456)
|
||||||
Rows Removed by Filter: 123457
|
Rows Removed by Filter: 123457
|
||||||
Columnar Chunks Removed by Filter: 0
|
Columnar Chunk Groups Removed by Filter: 0
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
SET columnar.enable_qual_pushdown TO DEFAULT;
|
SET columnar.enable_qual_pushdown TO DEFAULT;
|
||||||
|
@ -153,7 +153,7 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
Custom Scan (ColumnarScan) on simple_chunk_filtering (actual rows=20000 loops=1)
|
Custom Scan (ColumnarScan) on simple_chunk_filtering (actual rows=20000 loops=1)
|
||||||
Filter: (i > 180000)
|
Filter: (i > 180000)
|
||||||
Rows Removed by Filter: 1
|
Rows Removed by Filter: 1
|
||||||
Columnar Chunks Removed by Filter: 18
|
Columnar Chunk Groups Removed by Filter: 18
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
DROP TABLE simple_chunk_filtering;
|
DROP TABLE simple_chunk_filtering;
|
||||||
|
@ -167,7 +167,7 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
-> Custom Scan (ColumnarScan) on multi_column_chunk_filtering (actual rows=184567 loops=1)
|
-> Custom Scan (ColumnarScan) on multi_column_chunk_filtering (actual rows=184567 loops=1)
|
||||||
Filter: (a > 50000)
|
Filter: (a > 50000)
|
||||||
Rows Removed by Filter: 1
|
Rows Removed by Filter: 1
|
||||||
Columnar Chunks Removed by Filter: 5
|
Columnar Chunk Groups Removed by Filter: 5
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
EXPLAIN (analyze on, costs off, timing off, summary off)
|
EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
|
@ -178,7 +178,7 @@ EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||||
-> Custom Scan (ColumnarScan) on multi_column_chunk_filtering (actual rows=184567 loops=1)
|
-> Custom Scan (ColumnarScan) on multi_column_chunk_filtering (actual rows=184567 loops=1)
|
||||||
Filter: ((a > 50000) AND (b > 50000))
|
Filter: ((a > 50000) AND (b > 50000))
|
||||||
Rows Removed by Filter: 1
|
Rows Removed by Filter: 1
|
||||||
Columnar Chunks Removed by Filter: 5
|
Columnar Chunk Groups Removed by Filter: 5
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
DROP TABLE multi_column_chunk_filtering;
|
DROP TABLE multi_column_chunk_filtering;
|
||||||
|
|
Loading…
Reference in New Issue