optimiser questions

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: optimiser questions
Date: 2004-03-22 12:41:25
Message-ID: Pine.LNX.4.58.0403211613520.1609@mordor.coelho.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Hackers,

I had some performance problems with a plpgsql function I developped,
because the function is very costly (it involves querying tables) and the
query optimiser assumed basically that it was an inexpensive function.

I found a workaround, but the problem may worth being adressed:

Instead of doing:

filter costly_function(attribute of table1)
on join (table1, table2)

It did:

join(filter costly_function(attribute of table1) on table1,
table2)

This was a very bad idea, because table1 is much larger than join(table1,
table2) as some other low cost filtering conditions are available.

Question:

- how to tell the optimiser about the cost of an individual function
(I think that very costly would be enough).

I haven't found a clue about the issue in the documentation.
Maybe an additional field would be added to pg_proc and or pg_operator
is needed?

Have a nice day,

--
Fabien Coelho - coelho(at)cri(dot)ensmp(dot)fr

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-03-22 12:54:04 Re: [HACKERS] listening addresses
Previous Message Richard Huxton 2004-03-22 12:25:34 Re: pg_autovacuum next steps