From 453ac4072571cfe15cf900c78c592efba5e35707 Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Mon, 26 Jul 2021 17:15:35 +0300 Subject: [PATCH] Comment why we still remove non IndexPath's when custom scan is off --- src/backend/columnar/columnar_customscan.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/columnar/columnar_customscan.c b/src/backend/columnar/columnar_customscan.c index a1c91fedc..fe27cd15e 100644 --- a/src/backend/columnar/columnar_customscan.c +++ b/src/backend/columnar/columnar_customscan.c @@ -202,6 +202,13 @@ ColumnarSetRelPathlistHook(PlannerInfo *root, RelOptInfo *rel, Index rti, * we only consider ColumnarScanPath's & IndexPath's. For this reason, * we remove other paths and re-estimate IndexPath costs to make accurate * comparisons between them. + * + * Even more, we might calculate an equal cost for a + * ColumnarCustomScan and a SeqPath if we are reading all columns + * of given table since we don't consider chunk group filtering + * when costing ColumnarCustomScan. + * In that case, if we don't remove SeqPath's, we might wrongly choose + * SeqPath thinking that its cost would be equal to ColumnarCustomScan. */ RemovePathsByPredicate(rel, IsNotIndexPath); RecostColumnarPaths(root, rel, rte->relid);