Re: [PERFORM] Query much faster with enable_seqscan=0

2010-10-28 Thread Robert Haas
On Tue, Oct 12, 2010 at 10:28 PM, Samuel Gendler wrote: > > > On Tue, Sep 21, 2010 at 4:30 PM, Tom Lane wrote: >> >> Ogden writes: >> > SELECT tr.id, tr.sid >> >             FROM >> >             test_registration tr, >> >             INNER JOIN test_registration_result r on (tr.id = >> > r.test

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-10-12 Thread Samuel Gendler
On Tue, Sep 21, 2010 at 4:30 PM, Tom Lane wrote: > Ogden writes: > > SELECT tr.id, tr.sid > > FROM > > test_registration tr, > > INNER JOIN test_registration_result r on (tr.id = > r.test_registration_id) > > WHERE. > > > tr.test_administration_id=

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-10-12 Thread Ogden
On Sep 21, 2010, at 6:30 PM, Tom Lane wrote: > Ogden writes: >> SELECT tr.id, tr.sid >>FROM >>test_registration tr, >>INNER JOIN test_registration_result r on (tr.id = >> r.test_registration_id) >>WHERE. >> >> tr.test_administration_id

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-28 Thread Robert Haas
On Wed, Sep 22, 2010 at 9:36 AM, Ogden wrote: > > On Sep 21, 2010, at 2:34 PM, Ogden wrote: > >> >> On Sep 21, 2010, at 2:16 PM, Greg Smith wrote: >> >>> Joshua D. Drake wrote: PostgreSQL's defaults are based on extremely small and some would say (non production) size databases. As a mat

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-24 Thread Scott Carey
On Sep 22, 2010, at 6:36 AM, Ogden wrote: > > On Sep 21, 2010, at 2:34 PM, Ogden wrote: > >> >> On Sep 21, 2010, at 2:16 PM, Greg Smith wrote: >> >>> Joshua D. Drake wrote: PostgreSQL's defaults are based on extremely small and some would say (non production) size databases. As a ma

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-22 Thread Ogden
On Sep 21, 2010, at 2:34 PM, Ogden wrote: > > On Sep 21, 2010, at 2:16 PM, Greg Smith wrote: > >> Joshua D. Drake wrote: >>> PostgreSQL's defaults are based on extremely small and some would say >>> (non production) size databases. As a matter of course I always >>> recommend bringing seq_page_

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Tom Lane
Ogden writes: > SELECT tr.id, tr.sid > FROM > test_registration tr, > INNER JOIN test_registration_result r on (tr.id = > r.test_registration_id) > WHERE. > > tr.test_administration_id='32a22b12-aa21-11df-a606-96551e8f4e4c'::uuid >

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Tom Lane
Greg Smith writes: > and the query optimizer needs to be careful about what it does and > doesn't pull from disk. If that's not the case, like here where there's > 8GB of RAM and a 7GB database, dramatic reductions to both seq_page_cost > and random_page_cost can make sense. Don't be afraid t

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Ogden
On Sep 21, 2010, at 2:16 PM, Greg Smith wrote: > Joshua D. Drake wrote: >> PostgreSQL's defaults are based on extremely small and some would say >> (non production) size databases. As a matter of course I always >> recommend bringing seq_page_cost and random_page_cost more in line. >> > > Also

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Greg Smith
Joshua D. Drake wrote: PostgreSQL's defaults are based on extremely small and some would say (non production) size databases. As a matter of course I always recommend bringing seq_page_cost and random_page_cost more in line. Also, they presume that not all of your data is going to be in memo

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Joshua D. Drake
On Tue, 2010-09-21 at 14:02 -0500, Ogden wrote: > How odd, I set the following: > > seq_page_cost = 1.0 > random_page_cost = 2.0 > > And now the query runs in milliseconds as opposed to 14 seconds. Could this > really be the change? I am running ANALYZE now - how often is it recommended

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Ogden
How odd, I set the following: seq_page_cost = 1.0 random_page_cost = 2.0 And now the query runs in milliseconds as opposed to 14 seconds. Could this really be the change? I am running ANALYZE now - how often is it recommended to do this? Thank you Ogden On Sep 21, 2010, at 1:51 PM,

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Jesper Krogh
On 2010-09-21 20:21, Ogden wrote: I assume you mean random_page_cost? It is currently set to 4.0 - is it better to increase or decrease this value? Should be lowered to a bit over seq_page_cost.. and more importantly.. you should make sure that you have updated your statistics .. run "A

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Ogden
I assume you mean random_page_cost? It is currently set to 4.0 - is it better to increase or decrease this value? Thank you Ogden On Sep 21, 2010, at 1:06 PM, Kenneth Marshall wrote: > You DB is more than likely cached. You should adjust your > page costs to better reflect reality and then t

Re: [PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Kenneth Marshall
You DB is more than likely cached. You should adjust your page costs to better reflect reality and then the planner can make more accurate estimates and then choose the proper plan. Cheers, Ken On Tue, Sep 21, 2010 at 12:32:01PM -0500, Ogden wrote: > Hello, > > I have received some help from the

[PERFORM] Query much faster with enable_seqscan=0

2010-09-21 Thread Ogden
Hello, I have received some help from the IRC channel, however, the problem still exists. When running the following query with enable_seqscan set to 0, it takes less than a second, whereas with it set to 1, the query returns in 14 seconds. The machine itself has 8GB Ram and is running PostgreS