dbTalk Databases Forums  

SET PDQPRIORITY in an IF...THEN block?

comp.databases.informix comp.databases.informix


Discuss SET PDQPRIORITY in an IF...THEN block? in the comp.databases.informix forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John Hardin
 
Posts: n/a

Default SET PDQPRIORITY in an IF...THEN block? - 08-02-2012 , 12:59 PM






All:

I have some SP code that has a SET PDQPRIORITY N directive inside an
IF ... THEN block that checks the application configuration table to see
whether PDQ is enabled.

Can anyone (Art, ideally) confirm whether or not this will actually work
to control PDQ and will NOT use PDQ if the IF block evaluates to false? I
am getting objections to this from someone who seems to believe that the SP
will use PDQ if a SET PDQPRIORITY directive appears anywhere in it at
compile time...

TIA

--
John Hardin KA7OHZ
Senior Applications Developer, BI Specialist
EPICOR Retail
web: http://www.epicor.com
email: <jhardin (AT) epicor (DOT) com>

--- Posted via news://freenews.netfront.net/ - Complaints to news (AT) netfront (DOT) net ---

Reply With Quote
  #2  
Old   
Marco Greco
 
Posts: n/a

Default Re: SET PDQPRIORITY in an IF...THEN block? - 08-02-2012 , 03:23 PM






On 02/08/12 18:59, John Hardin wrote:
Quote:
All:

I have some SP code that has a SET PDQPRIORITY N directive inside an
IF ... THEN block that checks the application configuration table to see
whether PDQ is enabled.

Can anyone (Art, ideally) confirm whether or not this will actually work
to control PDQ and will NOT use PDQ if the IF block evaluates to false? I
am getting objections to this from someone who seems to believe that the SP
will use PDQ if a SET PDQPRIORITY directive appears anywhere in it at
compile time...

TIA

That somebody is correct. SP's run with the PDQ setting in effect at creation
/ update statistics time.
--
Ciao,
Marco
__________________________________________________ ____________________________
Marco Greco /UK /IBM Standard disclaimers apply!

Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
4glworks http://www.4glworks.com
Informix on Linux http://www.4glworks.com/ifmxlinux.htm

Reply With Quote
  #3  
Old   
Art Kagel
 
Posts: n/a

Default Re: SET PDQPRIORITY in an IF...THEN block? - 08-02-2012 , 04:06 PM



I don't know. Marco is correct as far as it goes, but I'm not sure whether
embedded SET PDQPRIORITY commands will do that.

One way to check.. create a procedure that selects its sysmaster:syssdblock
record before and after the IF statement that selects the SET PDQPRIORITY
and write the results to unload files for comparison. Here's the query:

select sdb_pdq_prio_req, sdb_pdq_priority
from sysmaster:syssdblock
where sdb_sessionid = dbinfo( 'sessionid');

If the set pdqpriority inside the procedure affects the whole procedure
then the priority before the SET command is executed will be the same as
the one after, ie the one set by the command. If the priority before is
the default of zero or of the current setting of the calling session, then
it's OK. This will also tell you if the set pdqpriority is effective
inside the session and you can check the same query after the procedure
exits in the session to see if the priority returns to default by itself or
if you will have to reset it after calling the function.

Art

Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/

Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
other organization with which I am associated either explicitly,
implicitly, or by inference. Neither do those opinions reflect those of
other individuals affiliated with any entity with which I am affiliated nor
those of the entities themselves.



On Thu, Aug 2, 2012 at 4:23 PM, Marco Greco <marco (AT) 4glworks (DOT) com> wrote:

Quote:

On 02/08/12 18:59, John Hardin wrote:
All:

I have some SP code that has a SET PDQPRIORITY N directive inside an
IF ... THEN block that checks the application configuration table to see
whether PDQ is enabled.

Can anyone (Art, ideally) confirm whether or not this will actually work
to control PDQ and will NOT use PDQ if the IF block evaluates to false? I
am getting objections to this from someone who seems to believe that the
SP
will use PDQ if a SET PDQPRIORITY directive appears anywhere in it at
compile time...

TIA

That somebody is correct. SP's run with the PDQ setting in effect at
creation
/ update statistics time.
--
Ciao,
Marco

__________________________________________________ ____________________________
Marco Greco /UK /IBM Standard disclaimers
apply!

Structured Query Scripting Language
http://www.4glworks.com/sqsl.htm
4glworks
http://www.4glworks.com
Informix on Linux
http://www.4glworks.com/ifmxlinux.htm
_______________________________________________
Informix-list mailing list
Informix-list (AT) iiug (DOT) org
http://www.iiug.org/mailman/listinfo/informix-list

Reply With Quote
  #4  
Old   
Jason Harris
 
Posts: n/a

Default Re: SET PDQPRIORITY in an IF...THEN block? - 08-04-2012 , 11:39 AM



Hi John,

PDQ for stored procedures is set at creation/update statistics time.

Executing a SET PDQPRIORITY statement within the stored procedure overridesthat.

Quote:
"The PDQ priority value that the database server uses to optimize or reoptimize an SQL statement is the value that was set by a SET PDQPRIORITY statement, which must have been executed within the same procedure. If no such statement has been executed, the value that was in effect when the procedure was last compiled or created is used."

See:
http://publib.boulder.ibm.com/infoce..._prf_603. htm

Jason

Reply With Quote
  #5  
Old   
John Hardin
 
Posts: n/a

Default Re: SET PDQPRIORITY in an IF...THEN block? - 08-23-2012 , 06:33 PM



On Thu, 02 Aug 2012 17:59:00 +0000, John Hardin wrote:

Quote:
I am getting objections to this from someone who seems to believe that
the SP will use PDQ if a SET PDQPRIORITY directive appears anywhere in
it at compile time...
That person has clarified, they were speaking of:

set pdqpriority 10;
create procedure abcd(...)

If this is done, and the application is configured to not use PDQ (e.g.
the embedded SET PDQPRIORITY N directives are _not_ executed because of
the IF test) will the SP still use PDQ?

Again, TIA.

--
John Hardin KA7OHZ
Senior Applications Developer, BI Specialist
EPICOR Retail
web: http://www.epicor.com
email: <jhardin (AT) epicor (DOT) com>

--- Posted via news://freenews.netfront.net/ - Complaints to news (AT) netfront (DOT) net ---

Reply With Quote
  #6  
Old   
Art Kagel
 
Posts: n/a

Default Re: SET PDQPRIORITY in an IF...THEN block? - 08-23-2012 , 07:00 PM



Yes, the procedure will always run with PDQPRIORITY 10.

Art

Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/

Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
other organization with which I am associated either explicitly,
implicitly, or by inference. Neither do those opinions reflect those of
other individuals affiliated with any entity with which I am affiliated nor
those of the entities themselves.



On Thu, Aug 23, 2012 at 7:33 PM, John Hardin <jhardin (AT) epicor (DOT) com> wrote:

Quote:
On Thu, 02 Aug 2012 17:59:00 +0000, John Hardin wrote:

I am getting objections to this from someone who seems to believe that
the SP will use PDQ if a SET PDQPRIORITY directive appears anywhere in
it at compile time...

That person has clarified, they were speaking of:

set pdqpriority 10;
create procedure abcd(...)

If this is done, and the application is configured to not use PDQ (e.g.
the embedded SET PDQPRIORITY N directives are _not_ executed because of
the IF test) will the SP still use PDQ?

Again, TIA.

--
John Hardin KA7OHZ
Senior Applications Developer, BI Specialist
EPICOR Retail
web: http://www.epicor.com
email: <jhardin (AT) epicor (DOT) com

--- Posted via news://freenews.netfront.net/ - Complaints to
news (AT) netfront (DOT) net ---
_______________________________________________
Informix-list mailing list
Informix-list (AT) iiug (DOT) org
http://www.iiug.org/mailman/listinfo/informix-list

Reply With Quote
  #7  
Old   
John Hardin
 
Posts: n/a

Default Re: SET PDQPRIORITY in an IF...THEN block? - 08-23-2012 , 07:07 PM



On Thu, 23 Aug 2012 20:00:55 -0400, Art Kagel wrote:

Quote:
Yes, the procedure will always run with PDQPRIORITY 10.
Okay. Thanks, Art.

In the initial scenario, assuming the SP is /not/ created with PDQPRIORITY
in effect as shown below, does an IF block around a PDQPRIORITY statement
within the SP allow the SP to intelligently decide whether or not to use
PDQ at runtime?

Quote:
On Thu, Aug 23, 2012 at 7:33 PM, John Hardin <jhardin (AT) epicor (DOT) com> wrote:

set pdqpriority 10;
create procedure abcd(...)

If this is done, and the application is configured to not use PDQ (e.g.
the embedded SET PDQPRIORITY N directives are _not_ executed because of
the IF test) will the SP still use PDQ?
--
John Hardin KA7OHZ
Senior Applications Developer, BI Specialist
EPICOR Retail
web: http://www.epicor.com
email: <jhardin (AT) epicor (DOT) com>

--- Posted via news://freenews.netfront.net/ - Complaints to news (AT) netfront (DOT) net ---

Reply With Quote
  #8  
Old   
Art Kagel
 
Posts: n/a

Default Re: SET PDQPRIORITY in an IF...THEN block? - 08-23-2012 , 07:48 PM



Yes. As long as the routine is compiled (ie created or recompiled with
update statistics for procedure/function) with PDQPRIORITY set to zero in
the compiling environment it will normally execute with the PDQPRIORITY of
the executing environment and will obey SET PDQPRIORITY statements embedded
in the procedure including conditional execution.

Art

Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/

Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
other organization with which I am associated either explicitly,
implicitly, or by inference. Neither do those opinions reflect those of
other individuals affiliated with any entity with which I am affiliated nor
those of the entities themselves.



On Thu, Aug 23, 2012 at 8:07 PM, John Hardin <jhardin (AT) epicor (DOT) com> wrote:

Quote:
On Thu, 23 Aug 2012 20:00:55 -0400, Art Kagel wrote:

Yes, the procedure will always run with PDQPRIORITY 10.

Okay. Thanks, Art.

In the initial scenario, assuming the SP is /not/ created with PDQPRIORITY
in effect as shown below, does an IF block around a PDQPRIORITY statement
within the SP allow the SP to intelligently decide whether or not to use
PDQ at runtime?

On Thu, Aug 23, 2012 at 7:33 PM, John Hardin <jhardin (AT) epicor (DOT) com> wrote:

set pdqpriority 10;
create procedure abcd(...)

If this is done, and the application is configured to not use PDQ (e.g.
the embedded SET PDQPRIORITY N directives are _not_ executed because of
the IF test) will the SP still use PDQ?

--
John Hardin KA7OHZ
Senior Applications Developer, BI Specialist
EPICOR Retail
web: http://www.epicor.com
email: <jhardin (AT) epicor (DOT) com

--- Posted via news://freenews.netfront.net/ - Complaints to
news (AT) netfront (DOT) net ---
_______________________________________________
Informix-list mailing list
Informix-list (AT) iiug (DOT) org
http://www.iiug.org/mailman/listinfo/informix-list

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.