Subject | Re: [firebird-support] Clear Query Cache Firebird 2.1 |
---|---|
Author | Christian Waldmann |
Post date | 2009-06-04T09:26:05Z |
Many thanks for all answers. Here is a summary of my observations:
The problem occurs, when I execute the following query:
select * from PROCGETFEEDERWARNINGS( '02.04.2009', '1.6.2009' )
The appended code shows that my stored procedure executes an other
stored procedure PROCGETWARNINGSTRING.
When altering the PROCGETWARNINGSTRING, the procedure
PROCGETFEEDERWARNINGS uses the outdated compiled code of
PROCGETWARNINGSTRING until all users are logged out, or the
PROCGETFEEDERWARNINGS is altered too.
Executing the query:
select * from PROCGETWARNINGSTRING 'C', 1 )
uses allways the actual code.
The behaviour is the same with FlameRobin and IBExpert.
Christian
------------------------------------------------------------------
create or alter procedure PROCGETFEEDERWARNINGS (
STARTDATE date,
ENDDATE date)
returns (
LABEL varchar(20),
ROOMNUMBER varchar(20),
LOGTIMESTAMP timestamp,
WARNING varchar(64))
as
declare variable VAR_KIND char(4);
declare variable VAR_PARAM bigint;
begin
for select tw.logtimestamp, tw.kind, tw.rfid as param,
coalesce( tf.label, '[undefined feeder]'), coalesce(
tf.roomnumber, '[undefined room]')
from tblWarning tw
left outer join tblfeeder tf on tw.uidfeeder = tf.uniqueid
where cast( tw.logtimestamp as date) between :startDate and
:endDate
order by tw.logtimestamp, tw.uniqueid
into LOGTIMESTAMP, VAR_KIND, VAR_PARAM, LABEL, ROOMNUMBER
do begin
execute procedure PROCGETWARNINGSTRING( VAR_KIND, VAR_PARAM )
returning_values WARNING;
suspend;
end
end^
The problem occurs, when I execute the following query:
select * from PROCGETFEEDERWARNINGS( '02.04.2009', '1.6.2009' )
The appended code shows that my stored procedure executes an other
stored procedure PROCGETWARNINGSTRING.
When altering the PROCGETWARNINGSTRING, the procedure
PROCGETFEEDERWARNINGS uses the outdated compiled code of
PROCGETWARNINGSTRING until all users are logged out, or the
PROCGETFEEDERWARNINGS is altered too.
Executing the query:
select * from PROCGETWARNINGSTRING 'C', 1 )
uses allways the actual code.
The behaviour is the same with FlameRobin and IBExpert.
Christian
------------------------------------------------------------------
create or alter procedure PROCGETFEEDERWARNINGS (
STARTDATE date,
ENDDATE date)
returns (
LABEL varchar(20),
ROOMNUMBER varchar(20),
LOGTIMESTAMP timestamp,
WARNING varchar(64))
as
declare variable VAR_KIND char(4);
declare variable VAR_PARAM bigint;
begin
for select tw.logtimestamp, tw.kind, tw.rfid as param,
coalesce( tf.label, '[undefined feeder]'), coalesce(
tf.roomnumber, '[undefined room]')
from tblWarning tw
left outer join tblfeeder tf on tw.uidfeeder = tf.uniqueid
where cast( tw.logtimestamp as date) between :startDate and
:endDate
order by tw.logtimestamp, tw.uniqueid
into LOGTIMESTAMP, VAR_KIND, VAR_PARAM, LABEL, ROOMNUMBER
do begin
execute procedure PROCGETWARNINGSTRING( VAR_KIND, VAR_PARAM )
returning_values WARNING;
suspend;
end
end^
> Hello
>
>
>
> I am developing stored procedures that are used in queries. It looks
> like my test queries do not use the output of the newest version of my
> stored procedure, but takes the result from the "query result cache" of
> the database.
>
>
>
> Stepping the procedure returns the expected results!
>
>
>
> Does the altering of stored procedure not clear the corresponding query
> cache?
>
> Is there a command to clear the cache or to force a query to generate
> new results?
>
>
>
> I am using Firebird Version "WI-V2.1.2.18118 Firebird 2.1" and IBExpert
> 2009.03.25
>
>
>
> Christian
>
>
>
> [Non-text portions of this message have been removed]
>