Re: [PERFORM] Trivial function query optimized badly

2007-01-03 Thread Craig A. James
Tom Lane wrote: "Craig A. James" <[EMAIL PROTECTED]> writes: CREATE OR REPLACE FUNCTION cansmiles(text) RETURNS text AS '/usr/local/pgsql/lib/libchem.so', 'cansmiles' LANGUAGE 'C' STRICT IMMUTABLE; Umm ... this is a single-argument function. db=> explain analyze select version_id, 'Brc

Re: [PERFORM] Trivial function query optimized badly

2007-01-03 Thread Tom Lane
"Craig A. James" <[EMAIL PROTECTED]> writes: > CREATE OR REPLACE FUNCTION cansmiles(text) RETURNS text > AS '/usr/local/pgsql/lib/libchem.so', 'cansmiles' > LANGUAGE 'C' STRICT IMMUTABLE; Umm ... this is a single-argument function. > db=> explain analyze select version_id, 'Brc1ccc2nc(cn2c1

Re: [PERFORM] Trivial function query optimized badly

2007-01-03 Thread Craig A. James
Adam Rich wrote: Craig, What version of postgres are you using? I just tested this on PG 8.1.2 and was unable to reproduce these results. I wrote a simple function that returns the same text passed to it, after sleeping for 1 second. I use it in a where clause, like your example below, and rega

Re: [PERFORM] Trivial function query optimized badly

2007-01-03 Thread Adam Rich
ailto:[EMAIL PROTECTED] On Behalf Of Craig A. James Sent: Wednesday, January 03, 2007 9:11 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Trivial function query optimized badly Well, once again I'm hosed because there's no way to tell the optimizer the cost for a user-defined fu

[PERFORM] Trivial function query optimized badly

2007-01-03 Thread Craig A. James
Well, once again I'm hosed because there's no way to tell the optimizer the cost for a user-defined function. I know this issue has already been raised (by me!) several times, but I have to remind everyone about this. I frequently must rewrite my SQL to work around this problem. Here is the