[PERFORM] Vacuum problem due to temp tables

2011-02-25 Thread Bhakti Ghatkar
Hi, We were running full vacuum on DB when we encountered the error below; INFO: analyzing "public.bkup_access_control" INFO: "bkup_access_control": scanned 14420 of 14420 pages, containing 1634113 live rows and 0 dead rows; 3 rows in sample, 1634113 estimated total rows INFO: vacuuming "p

Re: [PERFORM] Picking out the most recent row using a time stamp column

2011-02-25 Thread Dave Crooke
Hi Dave Yes, 100% the best solution I did the same thing a while back, I just have a separate copy of the data in a "latest" table and the Java code just runs a second SQL statement to update it when writing a new record (I've never been a trigger fan). I found myself looking at the "find th

Re: [PERFORM] Picking out the most recent row using a time stamp column

2011-02-25 Thread Dave Johansen
On Thu, Feb 24, 2011 at 4:38 PM, Dave Crooke wrote: > Thanks to all I had a tickling feeling at the back of my mind that > there was a neater answer here. For the record, times (all from in-memory > cached data, averaged over a bunch of runs): > > Dependent subquery = 117.9 seconds > Join to

[PERFORM] Index use difference betweer LIKE, LIKE ANY?

2011-02-25 Thread Sam Wong
I found that "LIKE", "= ANY (...)", "LIKE .. OR LIKE .." against a text field used the index correctly, but not "LIKE ANY (...)". Would that be a bug? Here is my table and index: CREATE TABLE shipment_lookup ( shipment_id text NOT NULL, lookup text NOT NULL ); CREATE INDEX shipment_lookup

Re: [PERFORM] Perl Binding affects speed?

2011-02-25 Thread Sam Wong
From: Martin Kjeldsen, Sent: 2011/2/25, 20:59 > > On 25/02/2011, at 13.25, Marti Raudsepp wrote: > > > On Fri, Feb 25, 2011 at 05:02, Sam Wong wrote: > >> * But if I do this - using binding: > >> $dbh->selectall_arrayref("SELECT * from shipment_lookup WHERE > >> (UPPER(lookup) LIKE ?)", undef,

Re: [PERFORM] Perl Binding affects speed?

2011-02-25 Thread Martin Kjeldsen
On 25/02/2011, at 13.25, Marti Raudsepp wrote: > On Fri, Feb 25, 2011 at 05:02, Sam Wong wrote: >> * But if I do this - using binding: >> $dbh->selectall_arrayref("SELECT * from shipment_lookup WHERE (UPPER(lookup) >> LIKE ?)", undef, '0GURG5YGVQA9%'); >> It took 10 seconds to finish the query,

Re: [PERFORM] Perl Binding affects speed?

2011-02-25 Thread Marti Raudsepp
On Fri, Feb 25, 2011 at 05:02, Sam Wong wrote: > * But if I do this - using binding: > $dbh->selectall_arrayref("SELECT * from shipment_lookup WHERE (UPPER(lookup) > LIKE ?)", undef, '0GURG5YGVQA9%'); > It took 10 seconds to finish the query, just like it was using full table > scan instead! Even

[PERFORM] Perl Binding affects speed?

2011-02-25 Thread Sam Wong
I run into performance problem when I pass the condition/variable in binding ways, however if I put them in the query string it's absolutely fine. Here is my table and index: CREATE TABLE shipment_lookup ( shipment_id text NOT NULL, lookup text NOT NULL ); CREATE INDEX shipment_lookup_pre