Postgres/Perl performance help needed

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Wed May 26 03:14:48 UTC 2004


Marcus Brubaker wrote:
> On Tue, 2004-05-25 at 16:16, Madison Kelly wrote:
> Try doing this for all of your statements, even the ones which don't
> return anything (eg updates and inserts).
> 
> This should not only help speed up your code (so that the statements
> aren't continually re-parsed) it should also reduce the risk of
> malformed SQL statements since bound parameters are automatically
> appropriately quoted and escaped.
> 
> Also, when you're doing your timing, be sure to remove your print
> statements unless they're crucial to the functioning of the script. 
> Setting up the print statement and printing to a console is a slow
> operation.
> 
> Another thing to look at is if unnecessary string conversions are
> happening.  E.G. if the field file_sr_uuid is an int and your statements
> end up as "WHERE file_src_uuid='n'" there *may* be an unneeded string
> conversion happening and you should instead do "WHERE file_src_uuid=n".
> 
> Hope this helps.
> 
> Regards,

Hi,

   Preparing the UPDATE made a significant difference (down from a 
steady 41 sec. to 29 sec. on my test partition with 2384 files and 
directories) but the counter and INSERT didn't make it better or worse. 
So then, that is the first big performance change. Thank you! Still not 
even close to fast enough so I'm going back to do more testing... :)

   Oh, I am now running my tests with only a log entry every 500 passes 
and that is just so that I can be sure something is still happening. All 
the prints have also been commented out.

Madison

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list