pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzbyj@telsasoft.com>
Subject: [PATCH v1] allow disabling indexscans but not bitmap scans
Date: Sat, 4 Jan 2020 10:25:12 -0600

---
 src/backend/optimizer/path/costsize.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index b5a0033..6f37386 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -972,7 +972,12 @@ cost_bitmap_heap_scan(Path *path, PlannerInfo *root, RelOptInfo *baserel,
 										 loop_count, &indexTotalCost,
 										 &tuples_fetched);
 
-	startup_cost += indexTotalCost;
+	if (indexTotalCost > disable_cost && enable_bitmapscan)
+		/* enable_indexscan=off no longer itself disables bitmap scans */
+		startup_cost += indexTotalCost - disable_cost;
+	else
+		startup_cost += indexTotalCost;
+
 	T = (baserel->pages > 1) ? (double) baserel->pages : 1.0;
 
 	/* Fetch estimated page costs for tablespace containing table. */
-- 
2.7.4


--r7U+bLA8boMOj+mD--





Message-ID: <no-message-id-4426@localhost>
Permalink:  ../no-message-id-4426@localhost/
Also on:    postgresql.org/message-id/no-message-id-4426@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pryzbyj@telsasoft.com
  Subject: Re: [PATCH v1] allow disabling indexscans but not bitmap scans
  In-Reply-To: <no-message-id-4426@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox