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

From: Markus Demleitner <msdemlei(at)ari(dot)uni-heidelberg(dot)de>
To: 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 14:48:11
Message-ID: 20250513144811.enpwh6sm5klsbkoc@victor
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear Tom,

On Tue, May 13, 2025 at 10:12:46AM -0400, Tom Lane wrote:
> Markus Demleitner <msdemlei(at)ari(dot)uni-heidelberg(dot)de> writes:
> > SELECT
> > CAST(ssa_dstype AS text) AS dataproduct_type,
> > CAST(NULL AS text) AS dataproduct_subtype,
> > CAST(2 AS smallint) AS calib_level,
> > ...
>
> 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? And the lazybone in me can't resist asking:
there's absolutely no way around this?

Thanks for setting my head straight,

Markus

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2025-05-13 15:06:31 Re: Index not used in certain nested views but not in others
Previous Message Tom Lane 2025-05-13 14:12:46 Re: Index not used in certain nested views but not in others