If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Drop Stored procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-08-08, 02:38
ani_dbforum ani_dbforum is offline
Registered User
 
Join Date: Nov 2007
Posts: 32
Drop Stored procedure

Hi,

I've a table and a Stored procedure which selects the data on the table.
When I drop the table and re-create the table, the performance of stored procedure become decreased. SP is taking more time.

When I drop and re-create the Stored procedure also it's executing fast.

Why the dropping and re-creating the stored procedure improves the performance though the Stored procedure pointing out the table name only?
Is it necessary to drop and recreate the stored procedure also whenever the table is dropped and re-created?
Reply With Quote
  #2 (permalink)  
Old 04-08-08, 04:53
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
When you drop the table on which the stored procedure (SP) depends, then DB2 notices that. The next time the SP is called, DB2 must verify that all dependencies can be resolved. Due to the DROP TABLE, this is not the case, of course. So DB2 has to recompile the stored procedure on the fly. This takes some time.

Do you see the performance degradation also when calling the SP repeatedly - without dropping anything in between?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old 04-08-08, 05:10
ani_dbforum ani_dbforum is offline
Registered User
 
Join Date: Nov 2007
Posts: 32
Thanks for the reply.
I ran 6 times and then dropped SP and re-created.
Reply With Quote
  #4 (permalink)  
Old 04-08-08, 05:19
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Let me phrase my question differently:
- you drop + recreate the table
- you call the procedure
- you call the procedure again
- you call the procedure yet again

What's the performance of the procedure in the second and third call?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On