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