Unix Technical Forum

Oddly slow queries

This is a discussion on Oddly slow queries within the Pgsql Performance forums, part of the PostgreSQL category; --> On 19.04.2008, at 19:11, Christopher Browne wrote: > Martha Stewart called it a Good Thing when spreng@socket.ch (Thomas > ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Performance

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 04-24-2008, 07:16 PM
Thomas Spreng
 
Posts: n/a
Default Re: Oddly slow queries

On 19.04.2008, at 19:11, Christopher Browne wrote:
> Martha Stewart called it a Good Thing when spreng@socket.ch (Thomas
> Spreng) wrote:
>> On 16.04.2008, at 17:42, Chris Browne wrote:
>> What I meant is if there are no INSERT's or UPDATE's going on it
>> shouldn't affect SELECT queries, or am I wrong?

>
> Yes, that's right. (Caveat: VACUUM would be a form of update, in this
> context...)


thanks for pointing that out, at the moment we don't run autovacuum but
VACUUM ANALYZE VERBOSE twice a day.

>>> 2. On the other hand, if you're on 8.1 or so, you may be able to
>>> configure the Background Writer to incrementally flush checkpoint
>>> data
>>> earlier, and avoid the condition of 1.
>>>
>>> Mind you, you'd have to set BgWr to be pretty aggressive, based on
>>> the
>>> "10s periodicity" that you describe; that may not be a nice
>>> configuration to have all the time :-(.

>>
>> I've just seen that the daily vacuum tasks didn't run,
>> apparently. The DB has almost doubled it's size since some days
>> ago. I guess I'll have to VACUUM FULL (dump/restore might be faster,
>> though) and check if that helps anything.

>
> If you're locking out users, then it's probably a better idea to use
> CLUSTER to reorganize the tables, as that simultaneously eliminates
> empty space on tables *and indices.*
>
> In contrast, after running VACUUM FULL, you may discover you need to
> reindex tables, because the reorganization of the *table* leads to
> bloating of the indexes.


I don't VACUUM FULL but thanks for the hint.

> Pre-8.3 (I *think*), there's a transactional issue with CLUSTER where
> it doesn't fully follow MVCC, so that "dead, but still accessible, to
> certain transactions" tuples go away. That can cause surprises
> (e.g. - queries missing data) if applications are accessing the
> database concurrently with the CLUSTER. It's safe as long as the DBA
> can take over the database and block out applications. And at some
> point, the MVCC bug got fixed.


I think I'll upgrade PostgreSQL to the latest 8.3 version in the next
few days anyway, along with a memory upgrade (from 1.5GB to 4GB) and a
new 2x RAID-1 (instead of RAID-5) disk configuration. I hope that this
has already a noticeable impact on the performance.

> Note that you should check the output of a VACUUM VERBOSE run, and/or
> use the contrib function pgsstattuples() to check how sparse the
> storage usage is. There may only be a few tables that are behaving
> badly, and cleaning up a few tables will be a lot less intrusive than
> cleaning up the whole database.


That surely is the case because about 90% of all data is stored in one
big table and most of the rows are deleted and newly INSERT'ed every
night.

cheers,

tom

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 04-24-2008, 07:16 PM
Scott Marlowe
 
Posts: n/a
Default Re: Oddly slow queries

On Tue, Apr 22, 2008 at 7:42 AM, Thomas Spreng <spreng@socket.ch> wrote:
>
> I think I'll upgrade PostgreSQL to the latest 8.3 version in the next
> few days anyway, along with a memory upgrade (from 1.5GB to 4GB) and a
> new 2x RAID-1 (instead of RAID-5) disk configuration. I hope that this
> has already a noticeable impact on the performance.


Note that if you have a good RAID controller with battery backed cache
and write back enabled, then you're probably better or / at least as
well off using four disks in a RAID-10 than two separate RAID-1 sets
(one for xlog and one for data).

Test to see. I've had better performance in general with the RAID-10 setup.

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 04-24-2008, 07:16 PM
Maha
 
Posts: n/a
Default Re: Oddly slow queries

Hi everyone,

I want to know how can you turn off logging in Psql ???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 04-29-2008, 09:32 PM
Thomas Spreng
 
Posts: n/a
Default Re: Oddly slow queries

On 22.04.2008, at 17:25, Scott Marlowe wrote:
> On Tue, Apr 22, 2008 at 7:42 AM, Thomas Spreng <spreng@socket.ch>
> wrote:
>>
>> I think I'll upgrade PostgreSQL to the latest 8.3 version in the next
>> few days anyway, along with a memory upgrade (from 1.5GB to 4GB)
>> and a
>> new 2x RAID-1 (instead of RAID-5) disk configuration. I hope that
>> this
>> has already a noticeable impact on the performance.

>
> Note that if you have a good RAID controller with battery backed cache
> and write back enabled, then you're probably better or / at least as
> well off using four disks in a RAID-10 than two separate RAID-1 sets
> (one for xlog and one for data).


I just wanted to let you know that upgrading Postgres from 8.1 to 8.3,
RAM from 1.5GB to 4GB and changing from a 3 disk RAID5 to 2x RAID1 (OS &
WAL, Tablespace) led to a significant speed increase. What's especially
important is that those randomly slow queries seem to be gone (for now).

Thanks for all the help.

Cheers,

Tom

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:43 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com