Re: [PERFORM] Performance Anomaly with "col in (A,B)" vs. "col = A OR col = B" ver. 9.0.3

2011-09-26 Thread Samuel Gendler
On Mon, Sep 26, 2011 at 2:11 PM, Timothy Garnett wrote: > > Though maybe in a lot of common use situations people only supply values > that are known present so maybe this would make things worse more often then > better (maybe limit 1 or better EXISTS would be a hint the value is not > known pres

Re: [PERFORM] Ineffective autovacuum

2011-09-26 Thread Royce Ausburn
On 27/09/2011, at 2:21 PM, Tom Lane wrote: > Royce Ausburn writes: >> I have a problem with autovacuum apparently not doing the job I need it to >> do. > > Hm, I wonder whether you're getting bit by bug #5759, which was fixed > after 8.3.12. If this were the case, would I see lots of auto v

Re: [PERFORM] postgres constraint triggers

2011-09-26 Thread Ben Chobot
On Sep 26, 2011, at 10:52 AM, Maria L. Wilson wrote: > Our first try to solve this problem has been to convert these triggers into a > constraint trigger which allows for DEFERRABLE INITIALLY DEFERRED flags. > This, we are finding, is forcing the trigger function to run after the > triggering

Re: [PERFORM] Ineffective autovacuum

2011-09-26 Thread Tom Lane
Royce Ausburn writes: > I have a problem with autovacuum apparently not doing the job I need it to do. Hm, I wonder whether you're getting bit by bug #5759, which was fixed after 8.3.12. > I have a table named datasession that is frequently inserted, updated and > deleted from. Typically the t

[PERFORM] Ineffective autovacuum

2011-09-26 Thread Royce Ausburn
Hi all, I have a problem with autovacuum apparently not doing the job I need it to do. I have a table named datasession that is frequently inserted, updated and deleted from. Typically the table will have a few thousand rows in it. Each row typically survives a few days and is updated every 5

Re: [PERFORM] Performance Anomaly with "col in (A,B)" vs. "col = A OR col = B" ver. 9.0.3

2011-09-26 Thread Timothy Garnett
> Well, the reason it likes the first plan is that that has a smaller > estimated cost ;-). Basically this is a startup-time-versus-total-time > issue: the cost of the seqscan+limit is estimated to be about 1/8447'th > of the time to read the whole table, since it's estimating 8447 > candidate mat

[PERFORM] postgres constraint triggers

2011-09-26 Thread Maria L. Wilson
Hi all I would like to start a dialogue and hear general feedback about the use of constraint triggers in postgres (8.4.5). Our overall issue is that using general triggers is causing slow inserts (from locking issues) in our database. Here are some details: A little background (jboss/

Re: [PERFORM] overzealous sorting?

2011-09-26 Thread anthony . shipman
On Monday 26 September 2011 19:39, Marc Cousin wrote: > Because Index Scans are sorted, not Bitmap Index Scans, which builds a > list of pages to visit, to be then visited by the Bitmap Heap Scan step. > > Marc. Where does this bitmap index scan come from? It seems to negate the advantages of b-t

Re: [PERFORM] Performance Anomaly with "col in (A,B)" vs. "col = A OR col = B" ver. 9.0.3

2011-09-26 Thread Tom Lane
Craig Ringer writes: > This has me wondering about putting together a maintenance/analysis tool > that generates and captures stats from several ANALYZE runs and compares > them to see if they're reasonably consistent. It then re-runs with > higher targets as a one-off, again to see if the stat

Re: [PERFORM] Performance Anomaly with "col in (A,B)" vs. "col = A OR col = B" ver. 9.0.3

2011-09-26 Thread Craig Ringer
On 27/09/2011 1:35 AM, Tom Lane wrote: Craig James writes: On 9/26/11 10:07 AM, Tom Lane wrote: Cranking up the statistics target for the hts_code_id column (and re-ANALYZEing) ought to fix it. If all your tables are this large you might want to just increase default_statistics_target across

Re: [PERFORM] slow query on tables with new columns added.

2011-09-26 Thread Filip Rembiałkowski
2011/9/26 M. D. > I have full access to the database, but no access to the application > source code. If creating an index will help, I can do that, but with the > columns I don't see it helping as I don't have access to the application > source to change that. > > So yes, by changing settings,

Re: [PERFORM] slow query on tables with new columns added.

2011-09-26 Thread M. D.
I have full access to the database, but no access to the application source code.  If creating an index will help, I can do that, but with the columns I don't see it helping as I don't have access to the application source to change that. So yes, by changing setting

Re: [PERFORM] [PERFORMANCE] Insights: fseek OR read_cluster?

2011-09-26 Thread Marti Raudsepp
On Mon, Sep 26, 2011 at 15:51, Antonio Rodriges wrote: >> What is read_cluster()  ? Are you talking about some kind of async and/or > > I meant that if you want to read a chunk of data from file you (1) > might not call traditional fseek but rather memorize hard drive > cluster numbers to boost di

Re: [PERFORM] Performance Anomaly with "col in (A,B)" vs. "col = A OR col = B" ver. 9.0.3

2011-09-26 Thread Tom Lane
Craig James writes: > On 9/26/11 10:07 AM, Tom Lane wrote: >> Cranking up the statistics target for the hts_code_id column (and >> re-ANALYZEing) ought to fix it. If all your tables are this large you might >> want to just increase default_statistics_target across the board. regards, >> tom lan

Re: [PERFORM] Performance Anomaly with "col in (A,B)" vs. "col = A OR col = B" ver. 9.0.3

2011-09-26 Thread Craig James
On 9/26/11 10:07 AM, Tom Lane wrote: Cranking up the statistics target for the hts_code_id column (and re-ANALYZEing) ought to fix it. If all your tables are this large you might want to just increase default_statistics_target across the board. regards, tom lane This is common advice in this for

Re: [PERFORM] Performance Anomaly with "col in (A,B)" vs. "col = A OR col = B" ver. 9.0.3

2011-09-26 Thread Tom Lane
Timothy Garnett writes: > -- Problematic Query > dev=> explain analyze SELECT "exp_detls".id FROM "exp_detls" WHERE > ("exp_detls"."hts_code_id" IN (12,654)) LIMIT 1; > Limit (cost=0.00..158.18 rows=1 width=4) (actual time=9661.363..9661.363 > rows=0 loops=1) >-> Seq Scan on exp_detls (cos

Re: [PERFORM] How to find record having % as part of data.

2011-09-26 Thread Biswa
I already have solution. Just have to use ESCAPE -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance

[PERFORM] How to find record having % as part of data.

2011-09-26 Thread Biswa
Hi, I am having problem retrieving data with % in the value. I tried a lot but so far i have no luck. for example i have first name = 'abc', middle name = 'pq%', last name = '123' I want to list all the entries that ends with %. Because those are wrong entries and i want to remove % from the midd

[PERFORM] Performance Anomaly with "col in (A,B)" vs. "col = A OR col = B" ver. 9.0.3

2011-09-26 Thread Timothy Garnett
Hi All, We are currently using PostgreSQL 9.0.3 and we noticed a performance anomaly from a framework (ActiveRecord) generated query to one of our tables. The query uses an in clause to check an indexed column for the presence of either of two values. In this particular case neither of them is p

[PERFORM] [PERFORMANCE] Insights: fseek OR read_cluster?

2011-09-26 Thread Antonio Rodriges
Hello, It is interesting how PostgreSQL reads the tablefiie. Whether its indexes store/use filesystem clusters locations containing required data (so it can issue a low level cluster read) or it just fseeks inside a file? Thank you -- Sent via pgsql-performance mailing list (pgsql-performance@p

Re: [PERFORM] [PERFORMANCE] Insights: fseek OR read_cluster?

2011-09-26 Thread Antonio Rodriges
Thank you, Craig, your answers are always insightful > What is read_cluster()  ? Are you talking about some kind of async and/or I meant that if you want to read a chunk of data from file you (1) might not call traditional fseek but rather memorize hard drive cluster numbers to boost disk seeks a

Re: [PERFORM] overzealous sorting?

2011-09-26 Thread Marc Cousin
Le Mon, 26 Sep 2011 16:28:15 +1000, anthony.ship...@symstream.com a écrit : > In Mammoth Replicator (PG 8.3) I have a table described as > >Table "public.tevent_cdr" > Column | Type | > Modifiers > +

Re: [PERFORM] [PERFORMANCE] Insights: fseek OR read_cluster?

2011-09-26 Thread Craig Ringer
On 24/09/2011 2:49 PM, Antonio Rodriges wrote: Hello, It is interesting how PostgreSQL reads the tablefiie. Whether its indexes store/use filesystem clusters locations containing required data (so it can issue a low level cluster read) or it just fseeks inside a file? What is read_cluster() ?