Re: Convert MAX_SAOP_ARRAY_SIZE to new guc

From: James Coleman <jtc331(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pramsey(at)cleverelephant(dot)ca, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Convert MAX_SAOP_ARRAY_SIZE to new guc
Date: 2018-11-16 14:55:47
Message-ID: CAAaqYe8XwXPnRRkPX_JKqJeEJYy+=L9Bw+chnm=WiGZKUv7YAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>> I'd be happy to yank this in favor of my holistic solution to this
>> problem I posted recently on the mailing list [1].
>
> [1] https://www.postgresql.org/message-id/flat/CAAaqYe8yKSvzbyu8w-dThRs9aTFMwrFxn_BkTYeXgjqe3CbNjg%40mail.gmail.com
>
> Not precisely sure what you mean - are you saying that we can just have an overall test for NOT NULL, which thereby avoids the need to expand the array and therefore dispenses with the GUC completely?
>
> Having indexes defined using WHERE NOT NULL is a very important use case.

I don't think we can avoid expanding the array for other cases (for
example, being able to infer that "foo < 5" for "foo IN (1,2,3,4)". If
we wanted to keep that inference without expanding the array we'd have
to (at minimum, I think) duplicate a lot of the existing inference
logic, but I haven't investigated it much.

So keeping the GUC could allow someone to tune how large an array can
be and still guarantee inferences like "foo < 5". But I'm not sure
that that is as valuable. At least I haven't run into cases where I've
noticed a need for it.

My patch only addresses the IS NOT NULL inference precisely for the
reason you state: we have lots of plans that (unless you tack on an
explicit "foo IS NOT NULL" to your query) the planner decides it can't
use WHERE NOT NULL indexes because it can't currently infer the
correctness of that for large arrays.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-11-16 14:56:53 Re: Convert MAX_SAOP_ARRAY_SIZE to new guc
Previous Message Tom Lane 2018-11-16 14:55:26 Re: Convert MAX_SAOP_ARRAY_SIZE to new guc