Re: Index not used in certain nested views but not in others

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Markus Demleitner <msdemlei(at)ari(dot)uni-heidelberg(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Index not used in certain nested views but not in others
Date: 2025-05-13 15:06:31
Message-ID: 4149.1747148791@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Markus Demleitner <msdemlei(at)ari(dot)uni-heidelberg(dot)de> writes:
> On Tue, May 13, 2025 at 10:12:46AM -0400, Tom Lane wrote:
>> Oh, well, that's your problem. The source tables' column types
>> need to match. Otherwise the UNIONs don't get flattened and you
>> don't get indexscans.

> Ahhhh... *source* tables. Sure, once I'm out of desperation stun, it
> kind of is unsurprising that the casts won't help me when it's about
> pulling up the original tables.

> Just to be sure: int and bigint don't mix, and neither do real and
> double precision, right?

[ checks code... ] Have to be the same datatype, but it looks like
we don't care about typmod (eg, varchar max length) or collations.
(hmm ... I'm wondering if nondeterministic collations have broken
this ...)

> And the lazybone in me can't resist asking:
> there's absolutely no way around this?

It would be a good bit of work, for sure.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Achilleas Mantzios 2025-05-13 17:12:12 Re: Postgresql 18beta1 and SPI changes
Previous Message Markus Demleitner 2025-05-13 14:48:11 Re: Index not used in certain nested views but not in others