Unix Technical Forum

How to test SQL statements with parameter markers?

This is a discussion on How to test SQL statements with parameter markers? within the DB2 forums, part of the Database Server Software category; --> Hi, Does anyone know how one could benchmark SQL statements with parameter markers? e.g.: SELECT * FROM SYSCAT.TABLES WHERE ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 11:00 AM
Erik Hendrix
 
Posts: n/a
Default How to test SQL statements with parameter markers?

Hi,

Does anyone know how one could benchmark SQL statements with parameter
markers?

e.g.: SELECT * FROM SYSCAT.TABLES WHERE TABNAME=?

I can provide values for the parameter makers, but I want it to be run (and
optimized) with the parameter
marker and not with a value like:
SELECT * FROM SYSCAT.TABLES WHERE TABNAME='test'

I thought I would be able to do this using db2batch but it does not look to
me like I can. Does anyone know of any other method? The plan chosen is
different when using parameter markers compared to values. So I need to be
able to benchmark this.
And I'm not a developer, just a simple DBA.

Thanks.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 11:00 AM
Ray Houle
 
Posts: n/a
Default Re: How to test SQL statements with parameter markers?

Quick answer, visual explain and dynexpln support dynamic SQL.

"Erik Hendrix" <hendrix_erik@hotmail.com> wrote in message
news:898d50e8a279efa79cc2ab92f3fc64cb@free.teranew s.com...
> Hi,
>
> Does anyone know how one could benchmark SQL statements with parameter
> markers?
>
> e.g.: SELECT * FROM SYSCAT.TABLES WHERE TABNAME=?
>
> I can provide values for the parameter makers, but I want it to be run

(and
> optimized) with the parameter
> marker and not with a value like:
> SELECT * FROM SYSCAT.TABLES WHERE TABNAME='test'
>
> I thought I would be able to do this using db2batch but it does not look

to
> me like I can. Does anyone know of any other method? The plan chosen is
> different when using parameter markers compared to values. So I need to be
> able to benchmark this.
> And I'm not a developer, just a simple DBA.
>
> Thanks.
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-26-2008, 11:00 AM
Lennart Jonsson
 
Posts: n/a
Default Re: How to test SQL statements with parameter markers?

"Erik Hendrix" <hendrix_erik@hotmail.com> wrote in message news:<898d50e8a279efa79cc2ab92f3fc64cb@free.terane ws.com>...
> Hi,
>
> Does anyone know how one could benchmark SQL statements with parameter
> markers?
>
> e.g.: SELECT * FROM SYSCAT.TABLES WHERE TABNAME=?
>
> I can provide values for the parameter makers, but I want it to be run (and
> optimized) with the parameter
> marker and not with a value like:
> SELECT * FROM SYSCAT.TABLES WHERE TABNAME='test'
>
> I thought I would be able to do this using db2batch but it does not look to
> me like I can. Does anyone know of any other method? The plan chosen is
> different when using parameter markers compared to values. So I need to be
> able to benchmark this.
> And I'm not a developer, just a simple DBA.
>
> Thanks.



Check out for example:

http://groups.google.com/groups?hl=e...abases.ibm-db2

HTH
/Lennart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 11:00 AM
Erik Hendrix
 
Posts: n/a
Default Re: How to test SQL statements with parameter markers?

Thanks to both Ray and Lennart, but I'm not looking for a explain plan. I'm
looking to actually run the
query and benchmark it. But I noticed through explain that the plan chosen
by the database is different between providing parameter markers and putting
the values in the statement itself. Thus I want to find out
by benchmarking it how much difference in runtime it will give me.

Thanks.
"Lennart Jonsson" <lennart@kommunicera.umea.se> wrote in message
news:6dae7e65.0307180806.264e893e@posting.google.c om...
> "Erik Hendrix" <hendrix_erik@hotmail.com> wrote in message

news:<898d50e8a279efa79cc2ab92f3fc64cb@free.terane ws.com>...
> > Hi,
> >
> > Does anyone know how one could benchmark SQL statements with parameter
> > markers?
> >
> > e.g.: SELECT * FROM SYSCAT.TABLES WHERE TABNAME=?
> >
> > I can provide values for the parameter makers, but I want it to be run

(and
> > optimized) with the parameter
> > marker and not with a value like:
> > SELECT * FROM SYSCAT.TABLES WHERE TABNAME='test'
> >
> > I thought I would be able to do this using db2batch but it does not look

to
> > me like I can. Does anyone know of any other method? The plan chosen is
> > different when using parameter markers compared to values. So I need to

be
> > able to benchmark this.
> > And I'm not a developer, just a simple DBA.
> >
> > Thanks.

>
>
> Check out for example:
>
>

http://groups.google.com/groups?hl=e...abases.ibm-db2
>
> HTH
> /Lennart



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-26-2008, 11:01 AM
Jean-Marc Blaise
 
Posts: n/a
Default Re: How to test SQL statements with parameter markers?

Erik,

You might have a look to the samples/java, and arrange a java script.
Hope this helps,

Jean-Marc


"Erik Hendrix" <hendrix_erik@hotmail.com> a écrit dans le message news:
898d50e8a279efa79cc2ab92f3fc64cb@free.teranews.com...
> Hi,
>
> Does anyone know how one could benchmark SQL statements with parameter
> markers?
>
> e.g.: SELECT * FROM SYSCAT.TABLES WHERE TABNAME=?
>
> I can provide values for the parameter makers, but I want it to be run

(and
> optimized) with the parameter
> marker and not with a value like:
> SELECT * FROM SYSCAT.TABLES WHERE TABNAME='test'
>
> I thought I would be able to do this using db2batch but it does not look

to
> me like I can. Does anyone know of any other method? The plan chosen is
> different when using parameter markers compared to values. So I need to be
> able to benchmark this.
> And I'm not a developer, just a simple DBA.
>
> Thanks.
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-26-2008, 11:01 AM
Christian Maslen
 
Posts: n/a
Default Re: How to test SQL statements with parameter markers?

Hi Erik,

WinSQL supports paramaters. They look like named parameters, but they
are sent to the server as markers.

Check it out at:

http://www.synametrics.com/winsql


Christian.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-26-2008, 11:02 AM
AK
 
Posts: n/a
Default Re: How to test SQL statements with parameter markers?

Erik,

Statistics are updateable, so
I would try to tweak the statistics so that the plan is the same no matter if
it's a parameter marker or the actual value is supplied.
Then use db2batch

don't forget to rerun the statistics when you are done with your benchmarks

good luck!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-26-2008, 11:02 AM
AK
 
Posts: n/a
Default Re: How to test SQL statements with parameter markers?

another option would be to wrap your parameterized statement in a stored procedure

and again: db2batch
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:32 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com