this time :
Total execution time: 0.265s

:)

Thanks for your help


________________________________
 From: Svein Erling Tysvær <[email protected]>
To: "'[email protected]'" <[email protected]> 
Sent: Tuesday, February 19, 2013 2:57 PM
Subject: RE: [firebird-support] Slow query using stored procedure
 

  
>Thanks a lot for your help, your script seems logically but execution time is 
>almost the same 
> 
>Total execution time: 0:01:59 (hh:mm:ss) Script execution finished. 
> 
>I debug and the execution of the procedure is not one time, now it is executed 
>19593 times 

OK, let's try brute force: 

SELECT a.date, a.id 
FROM  PR_GET_SOLD(2013,1) x 
LEFT JOIN mytable1 a ON x.numb = p.numb 
WHERE a.year = 2013 
UNION 
SELECT a.date, a.id 
FROM  mytable1 a 
WHERE a.year = 2013 
AND a.month = 1 

Providing a.id is unique, this should get the right result (UNION, as opposed 
to UNION ALL only returns unique rows) and it should not take two minutes! 

Sorry for not knowing of a more elegant solution, I use stored procedures far 
too rarely. 

Set 

 

[Non-text portions of this message have been removed]

Reply via email to