Merge pull request #16 from citusdata/analyze

Initial implementation of ANALYZE
merge-cstore-pykello
Hadi Moshayedi 2020-09-28 06:57:15 -07:00 committed by GitHub
commit 207eedc35a
2 changed files with 26 additions and 5 deletions

View File

@ -48,11 +48,11 @@ ifeq ($(USE_FDW),yes)
fdw_copyto fdw_alter fdw_truncate fdw_clean fdw_copyto fdw_alter fdw_truncate fdw_clean
endif endif
# disabled tests: am_block_filtering am_analyze # disabled tests: am_block_filtering
ifeq ($(USE_TABLEAM),yes) ifeq ($(USE_TABLEAM),yes)
PG_CFLAGS += -DUSE_TABLEAM PG_CFLAGS += -DUSE_TABLEAM
OBJS += cstore_tableam.o OBJS += cstore_tableam.o
REGRESS += am_create am_load am_query am_data_types am_functions \ REGRESS += am_create am_load am_query am_analyze am_data_types am_functions \
am_drop am_insert am_copyto am_alter am_truncate am_clean am_drop am_insert am_copyto am_alter am_truncate am_clean
endif endif

View File

@ -480,8 +480,13 @@ static bool
cstore_scan_analyze_next_block(TableScanDesc scan, BlockNumber blockno, cstore_scan_analyze_next_block(TableScanDesc scan, BlockNumber blockno,
BufferAccessStrategy bstrategy) BufferAccessStrategy bstrategy)
{ {
/* TODO */ /*
return false; * Our access method is not pages based, i.e. tuples are not confined
* to pages boundaries. So not much to do here. We return true anyway
* so acquire_sample_rows() in analyze.c would call our
* cstore_scan_analyze_next_tuple() callback.
*/
return true;
} }
@ -490,7 +495,23 @@ cstore_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin,
double *liverows, double *deadrows, double *liverows, double *deadrows,
TupleTableSlot *slot) TupleTableSlot *slot)
{ {
/* TODO */ /*
* Currently we don't do anything smart to reduce number of rows returned
* for ANALYZE. The TableAM API's ANALYZE functions are designed for page
* based access methods where it chooses random pages, and then reads
* tuples from those pages.
*
* We could do something like that here by choosing sample stripes or blocks,
* but getting that correct might need quite some work. Since cstore_fdw's
* ANALYZE scanned all rows, as a starter we do the same here and scan all
* rows.
*/
if (cstore_getnextslot(scan, ForwardScanDirection, slot))
{
(*liverows)++;
return true;
}
return false; return false;
} }