Constraint Exclusion With PreparedStatments

Поиск
Список
Период
Сортировка
Искать

Constraint Exclusion With PreparedStatments

От:
Majid Azimi <majid.merkava@gmail.com>
Дата:
gi guys,

I asked a question in Stackoverflow.com: How to use PreparedStatements
with constraint exclusion(Table partitioning). here is the question:

>According to PostgreSQL documentation section: 5.9.6. Caveats:
>Constraint exclusion only works when the query's WHERE clause contains constants. A parametrized query will not be optimized, since the planner cannot >know which partitions the parameter value might select at run time.
>Is there any library that provide some sort of PreparedStatment(I mean only SQL injection facility since we could not benefit from optimized performance of >PreparedStatment) and also generates a static SQL string so we could benefit from Constraint Exclusion feature?


someone answered you should use prepareTreashold set to 0 or very big
number. But he told:
>I'm not sure whether 0 this means "use prepared statements immediately" or "never use prepared statements"

Which one is the exact answer??
FAQ