Re: Question about Queries

From: Robert Klemme <shortcutter_at_googlemail.com>
Date: Thu, 25 Dec 2008 10:50:07 +0100
Message-ID: <6rh3ajF1n07kU1@mid.individual.net>


On 24.12.2008 18:44, mrdjmagnet_at_aol.com wrote:
> First, in terms of minimizing the number of parse/execute calls, it is
> suggested to use bind variables. However, why would a statement
> like: "SELECT address FROM emp WHERE name = 'John Doe';" get re-
> parsed? The statement is always the same, and never changes.

How likely is it that an application issues the exact same query over and over again? Even if the underlying data changes and thus results change accordingly, chances are that there's something wrong with this application.

The more realistic scenario is that the same query with a different literal is executed frequently => bind variables.

The only case where I can imagine literals in the query being beneficial is this: you have a state column with only few values but with very skewed data distribution. In this case performance might actually be better with literals although this is less and less the case with recent versions of Oracle.

Cheers

        robert Received on Thu Dec 25 2008 - 03:50:07 CST

Original text of this message