Thread: Re: index on custom function; explain

Re: index on custom function; explain

From
"Jan Aerts"
Date:
Some additional thoughts: what appears to take the most time (i.e.
account for the highest cost in the explain), is _not_ running the
function itself (cost=0.00..0.01), but comparing the result from that
function with the name1 column in the mappings table
(cost=0.00..35935.05). Am I right? (See EXPLAIN in previous post.) If
so: that's pretty strange, because the name1-column in the mappings
table is indexed...

jan.


Re: index on custom function; explain

From
Andrew McMillan
Date:
On Tue, 2005-10-04 at 03:10 -0700, Jan Aerts wrote:
> Some additional thoughts: what appears to take the most time (i.e.
> account for the highest cost in the explain), is _not_ running the
> function itself (cost=0.00..0.01), but comparing the result from that
> function with the name1 column in the mappings table
> (cost=0.00..35935.05). Am I right? (See EXPLAIN in previous post.) If
> so: that's pretty strange, because the name1-column in the mappings
> table is indexed...

35935.05 is for the loop, 0.01 is for the operation within the loop.

What version of PostgreSQL is this?  Some old versions were not good at
handling the IN ( ... ) clause.

Also, PostgreSQL doesn't always do a wonderful job of considering the
activities of a function into the design of the query plans.  Sometimes
this can be a blessing, but not in this case.

Cheers,
                    Andrew.

-------------------------------------------------------------------------
Andrew @ Catalyst .Net .NZ  Ltd,  PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/            PHYS: Level 2, 150-154 Willis St
DDI: +64(4)803-2201      MOB: +64(272)DEBIAN      OFFICE: +64(4)499-2267
It is truth which you cannot contradict; you can without any difficulty
                      contradict Socrates. - Plato

-------------------------------------------------------------------------


Attachment