row-specific conditions possible?

Поиск
Список
Период
Сортировка
От Jörg Kiegeland
Тема row-specific conditions possible?
Дата
Msg-id 496F1315.7070108@ikv.de
обсуждение исходный текст
Ответы Re: row-specific conditions possible?
Список pgsql-performance
Hi,

I want to store a boolean SQL condition in a column "condition_column"
of my table "myTable".
This condition refers to other columns of the same table and shall use
one parameter, e.g. "column1=4 AND colume2+column3=param".
Every row has a different condition in general..

So my query on the table should look like "SELECT * FROM myTable WHERE
anotherCondition AND EXECUTE condition_column(7)"
In this example, the concrete argument is "7".
However EXECUTE can only be used for prepared statements, and I dont
know how to prepare a statement within one single SQL query.
Does anybody know?

Our current solution is to execute "SELECT * FROM myTable WHERE
anotherCondition" where "anotherCondition" selects ~30% of the table,
and we evaluate the row-specific condition on client-side by our own
condition-evaluator, so that we finally have ~1% from the whole table as
result.
This however fetches 1/3 of the table over a remote JDBC connection. Its
clear that a server-side evaluation would also scan 1/3 of the table,
however only the final result would be transfered to the client.

Thanks for any help!

В списке pgsql-performance по дате отправления:

Предыдущее
От: Euler Taveira de Oliveira
Дата:
Сообщение: Re: index
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: row-specific conditions possible?