From: | "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Trivial function query optimized badly |
Date: | 2007-01-04 06:57:05 |
Message-ID: | 459CA541.3060009@modgraph-usa.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Tom Lane wrote:
> "Craig A. James" <cjames(at)modgraph-usa(dot)com> 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)C(=O)O' from version where version.isosmiles = cansmiles('Brc1ccc2nc(cn2c1)C(=O)O', 1);
>
> And this query is invoking some other, two-argument function; which
> apparently hasn't been marked IMMUTABLE, else it'd have been folded
> to a constant.
Good catch, mystery solved. There are two definitions for this function, the first just a "wrapper" for the second with the latter parameter defaulting to "1". The second definition was missing the "IMMUTABLE" keyword.
Thanks!
Craig
From | Date | Subject | |
---|---|---|---|
Next Message | Jeremy Haile | 2007-01-04 14:27:46 | Re: Performance of PostgreSQL on Windows vs Linux |
Previous Message | Tom Lane | 2007-01-04 05:46:50 | Re: Trivial function query optimized badly |