You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by welp <pe...@trivadis.com> on 2009/07/29 12:56:07 UTC

Using literals with JDBC the sampler instead of bind variables

Hoi again,

for some JDBC tests, I need to send the same query with different filters
(where conditions) against an Oracle database. usually, I would use the
"prepared select statement" query type for that using bind variables. But
for the Oracle Query Optimizer it can be a big difference when calculating
its execution plan if I use Bind Variables or if I use literals. Example:

select count(*) from v_whatever where xyz = ?    -- (with ? replaced by 4711
when preparing the statement)
or 
select count(*) from v_whatever where xyz = 4711

... can lead to very different executions plans and therefore also lead to
very different response times. Usually the execution plan that I get when
using literals (4711 directly instead of a ? in the prepared statement) is
often better - even Oracle completely needs to hard-parse the statement with
the literal - for long running queries in data warehouses, using literals
can lead to faster responses.

Hence I need to test it with literals but I want to get the literals from a
CSV file and not hard-code it into multpile JDBC samplers.

Is there a way to do this?

Thanks a lot in advance!
Regards
Peter
-- 
View this message in context: http://www.nabble.com/Using-literals-with-JDBC-the-sampler-instead-of-bind-variables-tp24716871p24716871.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Using literals with JDBC the sampler instead of bind variables

Posted by welp <pe...@trivadis.com>.

sebb-2-2 wrote:
> 
> Yes - just use CSV Dataset and code as follows:
> 
> select count(*) from v_whatever where xyz = ${NUMBER} and name="${NAME}"
> 
> Note that you need to add quotes for strings.
> 

Thanks a lot!

Sometimes, it's so easy :)

Cheers
Peter
-- 
View this message in context: http://www.nabble.com/Using-literals-with-the-JDBC-sampler-instead-of-bind-variables-tp24716871p24717280.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Using literals with JDBC the sampler instead of bind variables

Posted by sebb <se...@gmail.com>.
On 29/07/2009, welp <pe...@trivadis.com> wrote:
>
>  Hoi again,
>
>  for some JDBC tests, I need to send the same query with different filters
>  (where conditions) against an Oracle database. usually, I would use the
>  "prepared select statement" query type for that using bind variables. But
>  for the Oracle Query Optimizer it can be a big difference when calculating
>  its execution plan if I use Bind Variables or if I use literals. Example:
>
>  select count(*) from v_whatever where xyz = ?    -- (with ? replaced by 4711
>  when preparing the statement)
>  or
>  select count(*) from v_whatever where xyz = 4711
>
>  ... can lead to very different executions plans and therefore also lead to
>  very different response times. Usually the execution plan that I get when
>  using literals (4711 directly instead of a ? in the prepared statement) is
>  often better - even Oracle completely needs to hard-parse the statement with
>  the literal - for long running queries in data warehouses, using literals
>  can lead to faster responses.
>
>  Hence I need to test it with literals but I want to get the literals from a
>  CSV file and not hard-code it into multpile JDBC samplers.
>
>  Is there a way to do this?

Yes - just use CSV Dataset and code as follows:

select count(*) from v_whatever where xyz = ${NUMBER} and name="${NAME}"

Note that you need to add quotes for strings.

>  Thanks a lot in advance!
>  Regards
>  Peter
>
> --
>  View this message in context: http://www.nabble.com/Using-literals-with-JDBC-the-sampler-instead-of-bind-variables-tp24716871p24716871.html
>  Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org