From: | Wyatt Alt <wyatt(dot)alt(at)gmail(dot)com> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | Marko Tiikkaja <marko(at)joh(dot)to>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: [BUGS] BUG #11500: PRIMARY KEY index not being used |
Date: | 2025-10-04 04:00:27 |
Message-ID: | CAGem3qDgH3TQPMHvQD92GOnDmL9mbTGZVTm1eQVsmr8CkfhHew@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Oct 3, 2025 at 8:19 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> I can't off the top of my head think of a way to
> do that with an enum column.
>
Casting the enum to text seems to work:
EXPLAIN SELECT 1 FROM orders WHERE order_id = 1 AND state = 'WAIT_EVENT';
QUERY PLAN
------------------------------------------------------------------------------------
Index Scan using orders_wait_event_idx on orders (cost=0.12..2.34 rows=1
width=4)
Filter: (order_id = 1)
(2 rows)
EXPLAIN SELECT 1 FROM orders WHERE order_id = 1 AND state::text =
'WAIT_EVENT';
QUERY PLAN
--------------------------------------------------------------------------
Index Scan using orders_pkey on orders (cost=0.42..2.65 rows=1 width=4)
Index Cond: (order_id = 1)
Filter: ((state)::text = 'WAIT_EVENT'::text)
(3 rows)
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2025-10-04 16:51:33 | BUG #19072: New-style SQL language function referencing a temp table behaves oddly |
Previous Message | David Rowley | 2025-10-04 03:19:31 | Re: [BUGS] BUG #11500: PRIMARY KEY index not being used |