Optimizing queries

Поиск
Список
Период
Сортировка
Искать
От
Patrice Beliveau
Тема
Optimizing queries
Дата
Msg-id
44D8CE92.1080407@avior.ca
Список
Дерево обсуждения
Optimizing queries Patrice Beliveau <pbeliveau@avior.ca>
Re: Optimizing queries Scott Marlowe <smarlowe@g2switchworks.com>
Re: Optimizing queries Patrice Beliveau <pbeliveau@avior.ca>
Re: Optimizing queries Tom Lane <tgl@sss.pgh.pa.us>
Re: Optimizing queries Simon Riggs <simon@2ndquadrant.com>
Re: Optimizing queries Patrice Beliveau <pbeliveau@avior.ca>
Re: Optimizing queries Tom Lane <tgl@sss.pgh.pa.us>
Re: Optimizing queries Ruben Rubio <ruben@rentalia.com>
Re: Optimizing queries Patrice Beliveau <pbeliveau@avior.ca>
Hi,

I have a query that use a function and some column test to select row. 
It's in the form of:

SELECT * FROM TABLE
   WHERE TABLE.COLUMN1=something
      AND TABLE.COLUMN2=somethingelse
      AND function(TABLE.COLUMN3,TABLE.COLUMN4) > 0;

The result of the function does NOT depend only from the table, but also 
from some other tables.

Since it's long to process, I've add some output to see what's going on. 
I find out that the function process every row even if the row should be 
rejected as per the first or the second condition. Then , my question 
is: Is there a way to formulate a query that wont do all the check if it 
does not need to do it ? Meaning that, if condition1 is false then it 
wont check condition2 and that way the function will only be called when 
it's really necessary.

Thanks
В списке pgsql-performance по дате отправления
От: Steve Poe
Дата:
От: Scott Marlowe
Дата:
Сообщение: Re: Optimizing queries
FAQ