pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Dominique Devienne <ddevienne@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Non-Stored Generated Columns
Date: Thu, 29 Feb 2024 11:58:31 +0100
Message-ID: <e1cd5d6513d56c1005970eb6f333b5810de082a1.camel@cybertec.at> (raw)
In-Reply-To: <CAFCRh--Wf0ao2kDpqoDP_V_bDVCdnJE8YqDE52RR1Cf-0gwF1Q@mail.gmail.com>
References: <CAFCRh-_DodmoxMAS5r1sh9sAeAKDKReDiSKYH=rMLyEE3TpzQA@mail.gmail.com>
	<c634fdaa0e1795a6bf5fa6528a5750fc1c54c127.camel@cybertec.at>
	<CAFCRh-_2Pz0ZE9QH4gr9qYQW9bEFsnXefZxryJyeD-AgcOQAsg@mail.gmail.com>
	<2425903.1709147504@sss.pgh.pa.us>
	<CAFCRh--HTTob61MKzvi8NocOBoEECnOA=ZdR94tN6X=2KrSEig@mail.gmail.com>
	<dec069f5b59bb4565fbed5f4d8cb704c4c2fcdb5.camel@cybertec.at>
	<CAFCRh--Wf0ao2kDpqoDP_V_bDVCdnJE8YqDE52RR1Cf-0gwF1Q@mail.gmail.com>

On Thu, 2024-02-29 at 10:55 +0100, Dominique Devienne wrote:
> On Thu, Feb 29, 2024 at 10:03 AM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> 
> Honestly, I'm not sure why supporting the non-stored variant of generated
> columns is so controversial...
>  
> > I am sure there are some use cases for "virtual" generated columns, and
> > I don't think that a patch that tries to implement them will be rejected
> > out of hand.  It's just that I don't think it is a very important feature.
> 
> Fair enough. And a reaction I expected when I first posted.
> The outright rejection of it ever being useful, that's what surprised me.


I don't think anybody rejected the idea unconditionally.

But there is always a trade-off between the maintenance burden and the
usefulness of a feature.  All that was said is that the usefulness is low.

> > You could use conditional indexes, but then you have to make sure that
> > the optimizer knows it can use these indexes.
> 
> I'm not following. Are you saying the planner is not good at that on its own?
> I need to do something from my end???

I wasn't sure, but now I tested: a conditional index can also be used
by a cascading delete or update.  So that's not a worry.

> > The sum of the sizes of these indexes shouldn't exceed the size of an
> > unconditional index by much, but they would still be more expensive:
> > each statement would have to look through all the indexes to decide
> > which ones it can use and which ones not.
> 
> Something I maybe didn't make clear. The XArc virtual columns are never accessed.

Yes, they are.  The query planner considers all indexes.

Yours,
Laurenz Albe





view thread (14+ messages)  latest in thread

Message-ID: <e1cd5d6513d56c1005970eb6f333b5810de082a1.camel@cybertec.at>
Permalink:  ../e1cd5d6513d56c1005970eb6f333b5810de082a1.camel@cybertec.at/
Also on:    postgresql.org/message-id/e1cd5d6513d56c1005970eb6f333b5810de082a1.camel@cybertec.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, ddevienne@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Non-Stored Generated Columns
  In-Reply-To: <e1cd5d6513d56c1005970eb6f333b5810de082a1.camel@cybertec.at>
  References: <CAFCRh-_DodmoxMAS5r1sh9sAeAKDKReDiSKYH=rMLyEE3TpzQA@mail.gmail.com> <c634fdaa0e1795a6bf5fa6528a5750fc1c54c127.camel@cybertec.at> <CAFCRh-_2Pz0ZE9QH4gr9qYQW9bEFsnXefZxryJyeD-AgcOQAsg@mail.gmail.com> <2425903.1709147504@sss.pgh.pa.us> <CAFCRh--HTTob61MKzvi8NocOBoEECnOA=ZdR94tN6X=2KrSEig@mail.gmail.com> <dec069f5b59bb4565fbed5f4d8cb704c4c2fcdb5.camel@cybertec.at> <CAFCRh--Wf0ao2kDpqoDP_V_bDVCdnJE8YqDE52RR1Cf-0gwF1Q@mail.gmail.com> <e1cd5d6513d56c1005970eb6f333b5810de082a1.camel@cybertec.at>

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

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