Re: Text-any concatenation volatility acting as optimization barrier
| От | Marti Raudsepp |
|---|---|
| Тема | Re: Text-any concatenation volatility acting as optimization barrier |
| Дата | |
| Msg-id | CABRT9RAF+9EnC0qcZrBd=4g8GQGXcPQxvN2=LWJAtG3H06gkTA@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Text-any concatenation volatility acting as optimization barrier (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: Text-any concatenation volatility acting as
optimization barrier
|
| Список | pgsql-hackers |
On Wed, Feb 8, 2012 at 06:21, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Marti Raudsepp <marti@juffo.org> writes: >> Case #1 uses the normal textcat(text, text) operator by automatically >> coercing 'x' as text. >> However, case #2 uses the anytextcat(anynonarray, text), which is >> marked as volatile thus acts as an optimization barrier. > > Hmm ... since those operators were invented (in 8.3), we have adopted a > policy that I/O functions are presumed to be no worse than stable: > http://archives.postgresql.org/pgsql-committers/2010-07/msg00307.php > ISTM that would justify relabeling anytextcat/textanycat as stable, > which should fix this. Yes, we should definitely take advantage of that. I scanned through all of pg_proc, there are 4 functions like this that can be changed: textanycat, anytextcat, quote_literal and quote_nullable. All of these have SQL wrappers to cast their argument to ::text. quote_literal | select pg_catalog.quote_literal($1::pg_catalog.text) quote_nullable | select pg_catalog.quote_nullable($1::pg_catalog.text) textanycat | select $1 || $2::pg_catalog.text anytextcat | select $1::pg_catalog.text || $2 Patch attached (in git am format). Passes all regression tests (except 'json' which fails on my machine even on git master). No documentation changes necessary AFAICT. Regards, Marti
Вложения
В списке pgsql-hackers по дате отправления: