[HACKERS] eval_const_expresisions and ScalarArrayOpExpr
От
Heikki Linnakangas
Тема
[HACKERS] eval_const_expresisions and ScalarArrayOpExpr
Дата
Msg-id
3be3b82c-e29c-b674-2163-bf47d98817b1@iki.fi
Список
Дерево обсуждения
[HACKERS] eval_const_expresisions and ScalarArrayOpExpr Heikki Linnakangas <hlinnaka@iki.fi>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Heikki Linnakangas <hlinnaka@iki.fi>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Michael Paquier <michael.paquier@gmail.com>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Dmitry Dolgov <9erthalion6@gmail.com>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Dmitry Dolgov <9erthalion6@gmail.com>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Robert Haas <robertmhaas@gmail.com>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] eval_const_expresisions and ScalarArrayOpExpr Robert Haas <robertmhaas@gmail.com>
Eval_const_expressions() doesn't know about ScalarArrayOpExpr. We
simplify the arguments, but if all the arguments are booleans, we don't
take the obvious step of replacing the whole expression with a boolean
Const. For example:
postgres=# explain select * from foo where 1 IN (1,2,3);
QUERY PLAN
-------------------------------------------------------------
Result (cost=0.00..35.50 rows=2550 width=4)
One-Time Filter: (1 = ANY ('{1,2,3}'::integer[]))
-> Seq Scan on foo (cost=0.00..35.50 rows=2550 width=4)
(3 rows)
I would've expected that to be fully evaluated at plan-time, and
optimized away.
That seems like an oversight. I guess that scenario doesn't happen very
often in practice, but there's no reason not to do it when it does.
Patch attached.
On a side-note, I find it a bit awkward that ScalarArrayOpExpr uses a
2-element List to hold the scalar and array arguments. Wouldn't it be
much more straightforward to have explicit "Expr *scalararg" and "Expr
*arrayarg" fields?
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
В списке pgsql-hackers по дате отправления
От: Simon Riggs
Дата: