Re: strange performance regression between 7.4 and 8.1 - Mailing list pgsql-performance

From Alex Deucher
Subject Re: strange performance regression between 7.4 and 8.1
Date
Msg-id a728f9f90703011511m4a0a64fawd65d443ab92b65a4@mail.gmail.com
Whole thread Raw
In response to Re: strange performance regression between 7.4 and 8.1  (Jeff Frost <jeff@frostconsultingllc.com>)
Responses Re: strange performance regression between 7.4 and 8.1
List pgsql-performance
On 3/1/07, Jeff Frost <jeff@frostconsultingllc.com> wrote:
> On Thu, 1 Mar 2007, Joshua D. Drake wrote:
>
> > Alex Deucher wrote:
> >> Hello,
> >>
> >> I have noticed a strange performance regression and I'm at a loss as
> >> to what's happening.  We have a fairly large database (~16 GB).  The
> >> original postgres 7.4 was running on a sun v880 with 4 CPUs and 8 GB
> >> of ram running Solaris on local scsi discs.  The new server is a sun
> >> Opteron box with 4 cores, 8 GB of ram running postgres 8.1.4 on Linux
> >> (AMD64) on a 4 Gbps FC SAN volume.  When we created the new database
> >> it was created from scratch rather than copying over the old one,
> >> however the table structure is almost identical (UTF8 on the new one
> >> vs. C on the old). The problem is queries are ~10x slower on the new
> >> hardware.  I read several places that the SAN might be to blame, but
> >> testing with bonnie and dd indicates that the SAN is actually almost
> >> twice as fast as the scsi discs in the old sun server.  I've tried
> >> adjusting just about every option in the postgres config file, but
> >> performance remains the same.  Any ideas?
> >
> > Vacuum? Analayze? default_statistics_target? How many shared_buffers?
> > effective_cache_size? work_mem?
>
> Also, an explain analyze from both the 7.4 and 8.1 systems with one of the
> 10x slower queries would probably be handy.

here are some examples.  Analyze is still running on the new db, I'll
post results when that is done.  Mostly what our apps do is prepared
row selects from different tables:
select c1,c2,c3,c4,c5 from t1 where c1='XXX';

old server:
db=# EXPLAIN ANALYZE select c1,c2 from t1 where c2='6258261';
                                                        QUERY PLAN

---------------------------------------------------------------------------------------------------------------------------
 Index Scan using t1_c2_index on t1  (cost=0.00..166.89 rows=42
width=26) (actual time=5.722..5.809 rows=2 loops=1)
   Index Cond: ((c2)::text = '6258261'::text)
 Total runtime: 5.912 ms
(3 rows)

db=# EXPLAIN ANALYZE select c1,c2 from t1 where c1='6258261';
                                                         QUERY PLAN

----------------------------------------------------------------------------------------------------------------------------
 Index Scan using t1_c1_key on t1  (cost=0.00..286.08 rows=72
width=26) (actual time=12.423..12.475 rows=12 loops=1)
   Index Cond: ((c1)::text = '6258261'::text)
 Total runtime: 12.538 ms
(3 rows)


new server:
db=# EXPLAIN ANALYZE select c1,c2 from t1 where c2='6258261';
                                                         QUERY PLAN

----------------------------------------------------------------------------------------------------------------------------
 Index Scan using t1_c2_index on t1  (cost=0.00..37.63 rows=11
width=26) (actual time=33.461..51.377 rows=2 loops=1)
   Index Cond: ((c2)::text = '6258261'::text)
 Total runtime: 51.419 ms
(3 rows)

db=# EXPLAIN ANALYZE select c1,c2 from t1 where c1='6258261';
                                                           QUERY PLAN

--------------------------------------------------------------------------------------------------------------------------------
 Index Scan using t1_c1_index on t1  (cost=0.00..630.45 rows=2907
width=26) (actual time=45.733..46.271 rows=12 loops=1)
   Index Cond: ((c1)::text = '6258261'::text)
 Total runtime: 46.325 ms
(3 rows)


Alex

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: stats collector process high CPU utilization
Next
From: Jeff Frost
Date:
Subject: Re: strange performance regression between 7.4 and 8.1