From: Tom Lane <tgl@sss.pgh.pa.us>
To: victorq@extrahop.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18968: GiST Index Cost Estimation
Date: Fri, 27 Jun 2025 17:03:14 -0400
Message-ID: <2071611.1751058194@sss.pgh.pa.us> (raw)
In-Reply-To: <18968-eb7187b33887f562@postgresql.org>
References: <18968-eb7187b33887f562@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> When a text column has both a B-tree unique index and a GiST gist_trgm_ops
> index, sometimes the planner estimates a slightly lower cost to use the GiST
> index for an IN/ANY query with a constant list, but the actual cost to use
> the GiST index is orders of magnitude higher than the B-tree index, e.g. 2
> min versus 6 ms in the example below. Is the GiST index cost estimate too
> low for gist_trgm_ops? This seems similar to a relatively recent discussion
> (2022) regarding GiN, GiST index cost (versus B-Tree) that led to a patch
> https://www.postgresql.org/message-id/flat/3188617.44csPzL39Z%40aivenronan .
Yeah, I complained at [1] that GIST and some of the other index types
were not producing sane cost estimates compared to btree, but the
thread trailed off after fixing only GIN. So that's still an open
topic for investigation. If you can figure out how to improve
matters, a patch would be welcome.
regards, tom lane
[1] https://www.postgresql.org/message-id/4153708.1662675130%40sss.pgh.pa.us
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, victorq@extrahop.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18968: GiST Index Cost Estimation
In-Reply-To: <2071611.1751058194@sss.pgh.pa.us>
* 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