pgsql: Do ScalarArrayOp estimation correctly when array is a stable exp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Do ScalarArrayOp estimation correctly when array is a stable exp
Date: 2014-02-21 22:11:00
Message-ID: E1WGyJA-0000cS-JF@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Do ScalarArrayOp estimation correctly when array is a stable expression.

Most estimation functions apply estimate_expression_value to see if they
can reduce an expression to a constant; the key difference is that it
allows evaluation of stable as well as immutable functions in hopes of
ending up with a simple Const node. scalararraysel didn't get the memo
though, and neither did gincost_opexpr/gincost_scalararrayopexpr. Fix
that, and remove a now-unnecessary estimate_expression_value step in the
subsidiary function scalararraysel_containment.

Per complaint from Alexey Klyukin. Back-patch to 9.3. The problem
goes back further, but I'm hesitant to change estimation behavior in
long-stable release branches.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/77585bce03042e8fee62d8df0dde9c008a904699

Modified Files
--------------
src/backend/utils/adt/array_selfuncs.c | 15 ++++++++-------
src/backend/utils/adt/selfuncs.c | 22 ++++++++++++++++++----
2 files changed, 26 insertions(+), 11 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2014-02-22 18:46:49 pgsql: pg_basebackup: Add support for relocating tablespaces
Previous Message Heikki Linnakangas 2014-02-21 13:48:29 pgsql: Avoid integer overflow in hstore_to_json().