public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Markus Demleitner <[email protected]>
Cc: [email protected]
Subject: Re: Index not used in certain nested views but not in others
Date: Tue, 13 May 2025 10:12:46 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <20250512141217.4dwnfxbaf53mhvi7@victor>
References: <20250430151647.7kootztymzznydn5@victor>
	<[email protected]>
	<[email protected]>
	<20250512141217.4dwnfxbaf53mhvi7@victor>

Markus Demleitner <[email protected]> writes:
> You see, when creating the "big", 30-tables view, I do cast all
> columns to common types in the view statement that actually make up
> the view.  The original SQL fragments look like this:

>   SELECT
>     CAST(ssa_dstype AS text) AS dataproduct_type,
>     CAST(NULL AS text) AS dataproduct_subtype,
>     CAST(2 AS smallint) AS calib_level,
>     ...

> and have a common source, so I'd believe by the time the things end
> up in the view, they should type-align even though their source
> tables do not.

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.

			regards, tom lane






view thread (2+ messages)  latest in thread

reply

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Index not used in certain nested views but not in others
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox