Re: Index not used in certain nested views but not in others - Mailing list pgsql-general

From Tom Lane
Subject Re: Index not used in certain nested views but not in others
Date
Msg-id 4149.1747148791@sss.pgh.pa.us
Whole thread Raw
In response to Re: Index not used in certain nested views but not in others  (Markus Demleitner <msdemlei@ari.uni-heidelberg.de>)
List pgsql-general
Markus Demleitner <msdemlei@ari.uni-heidelberg.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



pgsql-general by date:

Previous
From: Markus Demleitner
Date:
Subject: Re: Index not used in certain nested views but not in others
Next
From: Achilleas Mantzios
Date:
Subject: Re: Postgresql 18beta1 and SPI changes