cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhi <su...@planet.net>
Subject Re: AW: Executing Prepared Statement
Date Thu, 25 May 2000 13:22:23 GMT
> Much better performance (at least with Oracle).
> If a statement has _exactly_ the same sql text as a cached previously
> executed statement,
> then there's no need for Oracle to reparse it and determine how to execute
> it internally.
> If one uses
> "select ENAME from EMP where EMPNO = 10"
> and then
> "select ENAME from EMP where EMPNO = 20"
> these are two different statements, the second one has to go all the way
> through parsing,
> and determine how to physically fetch the record.
> But if one uses
> "select ENAME from EMP where EMPNO = ?"
> two times with different values for the parameter ?,
> then the second statement can be executed much faster, since the "howto
> access information"
> is still in the cache from the first statement.
> This is true for Oracle and I suppose for many other RDBMs as well.
> Henning
> 

Yeah, you are absolutely right. One more thing I can think of is , if
you are using prepared statement you dont have to escape the variables
values. 
For ex: "select recipe from recipes where  recipe_name = 'abc's'";
Where you have to escape the ' in abc's. If you are using
PreparedStatement I dont think you have to do that. (its simple example,
it might not be correct).

Mime
View raw message