PL/PgSQL Index Usage with Trigger Variables

Поиск
Список
Период
Сортировка
Искать
От
Thomas F.O'Connell
Тема
PL/PgSQL Index Usage with Trigger Variables
Дата
Msg-id
8106D11D-6971-11D9-90FF-000D93AE0944@sitening.com
Список
Дерево обсуждения
PL/PgSQL Index Usage with Trigger Variables Thomas F.O'Connell <tfo@sitening.com>
Re: PL/PgSQL Index Usage with Trigger Variables Michael Fuhr <mike@fuhr.org>
I've got a question about how PL/PgSQL passes things to the planner 
based on statement logging.

E.g., I have a statement like this in PL/PgSQL:

UPDATE mytable SET mybigintcol = somevalue WHERE mybigintcol = 
NEW.myotherbigintcol;

This shows up in the logs with the NEW variable converted to unquoted 
constant data. Is PL/PgSQL smart enough to help the planner figure out 
that it can use an index on mybigintcol based on the fact that the type 
of myotherbigintcol can be discerned from the record of NEW? Or is type 
information not available as the record variable is interpolated and 
passed to the planner?

As in, should I rewrite the above statement as:

UPDATE mytable SET mybigintcol = somevalue WHERE mybigintcol = '''''' 
|| NEW.myotherbigintcol || '''''';

in order to help the planner understand that it can use an index?

-tfo

--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005

В списке pgsql-general по дате отправления
От: David Klugmann
Дата:
От: Michael Fuhr
Дата:
FAQ