Constraint Exclusion With PreparedStatments

From: Majid Azimi <majid(dot)merkava(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Constraint Exclusion With PreparedStatments
Date: 2011-10-28 23:36:12
Message-ID: CADOhCmv0bNmqGE4kQUqUtELLK0-dX9fQRUKQX6rrY0P5OMqQXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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??

Browse pgsql-novice by date

  From Date Subject
Next Message Sergio Sinuco 2011-10-29 18:56:01 Updating Using RowType
Previous Message Arvind Sharma 2011-10-28 17:02:34 Re: PgAdmin III shows removed PostgreSQL