473,378 Members | 1,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Forcing a stored procedure recompile

Hello everyone.

Can anyone suggest if there's a way to force a plpgsql stored procedure
to be recompiled every time that it's called, based on the values of the
parameters that it's given? I assumed it would be possible, but
unfortunately haven't been able to find any documentation on how to
force a recompile at all, let alone automatically.

I've encountered a situation where the standard precompiled generic
query plan isn't working at all well with the unknown variables that the
stored procedure receives. It seems to do nicely if I replace them with
constants, though. (Compilation time isn't really an issue in this
situation, but I'd like to leave everything in the stored procedure for
other reasons.)

I could probably re-write the procedure to concatenate a string
containing the unknowns as constants and then EXECUTE it. Doing it that
way seems a bit ugly, though, and it'd make maintenance a bigger problem.
Thanks in advance for any help or suggestions.
Mike.
Nov 23 '05 #1
1 2319
Mike McGavin wrote:
Hello everyone.

Can anyone suggest if there's a way to force a plpgsql stored procedure
to be recompiled every time that it's called, based on the values of the
parameters that it's given? I assumed it would be possible, but
unfortunately haven't been able to find any documentation on how to
force a recompile at all, let alone automatically.

I've encountered a situation where the standard precompiled generic
query plan isn't working at all well with the unknown variables that the
stored procedure receives. It seems to do nicely if I replace them with
constants, though. (Compilation time isn't really an issue in this
situation, but I'd like to leave everything in the stored procedure for
other reasons.)

I could probably re-write the procedure to concatenate a string
containing the unknowns as constants and then EXECUTE it. Doing it that
way seems a bit ugly, though, and it'd make maintenance a bigger problem.


Right now unfortunately this is the only one solution.

See the post on performance (8/28/2004) with the title:

ill-planned queries inside a stored procedure"


Regards
Gaetano Mendola
Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: P | last post by:
I would like to call my stored proc and invoke the WITH RECOMPILE option. I can't figure out what to set in ADO to make that happen. Anyone know how to make this work? BTW, I _don't_ want to...
12
by: serge | last post by:
I have an SP that is big, huge, 700-800 lines. I am not an expert but I need to figure out every possible way that I can improve the performance speed of this SP. In the next couple of weeks I...
10
by: Thomas R. Hummel | last post by:
I have a stored procedure that suddenly started performing horribly. The query plan didn't look right to me, so I copy/pasted the code and ran it (it's a single SELECT statement). That ran pretty...
5
by: Magnus Österberg | last post by:
My application fetches a batch of data through a web service and writes 1000 entities per batch to a SQL Server 2000 database. There are 4 tables in every batch. There are the following number of...
1
by: Alex | last post by:
Hi all, Just been dabbling with java stored procedures and I'm having problems replacing System: db2 8.1.4 on RH 7.1 linux system 1). Look at java jdbc samples as supplied with db2 and run...
8
by: Steven Blair | last post by:
Hi, I have a system which processes 1000's of transactions per hour. Part of each transaction process invloves me calling a stored procdure which updates various tables. What I want to know is,...
45
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
12
by: Jason Huang | last post by:
Hi, In my C# Windows Form application project, I have done all queries on my codes. Now I wanna try using the Stored Procedure. But I am not clear about why using the stored procedure. Would...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.