Re: PostgreSQL 9.0.1 on Windows performance tunning help please

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "tuanhoanganh" <hatuan05(at)gmail(dot)com>, "pgsql-performance" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: PostgreSQL 9.0.1 on Windows performance tunning help please
Date: 2011-08-05 17:20:59
Message-ID: 4E3BE02B020000250003FB8A@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

tuanhoanganh <hatuan05(at)gmail(dot)com> wrote:

> I have postgresql 9.0.1

http://www.postgresql.org/support/versioning

> 6GB ram

> work_mem = 2097151

I think that has the potential to push you into swapping:

cc=> set work_mem = 2097151;
SET
cc=> show work_mem;
work_mem
-----------
2097151kB
(1 row)

That's 2GB, and that much can be allocated, potentially several
times, per connection.

> -> Index Scan using sym_data_pkey on sym_data d
> (cost=0.00..637148.72 rows=3129103 width=1403)
> (actual time=71.989..55643.665 rows=3124631 loops=1)
> Filter: ((channel_id)::text = 'sale_transaction'::text)

This index scan is going to randomly access all tuples in the
table's heap. That is probably going to be much slower than a
sequential scan. It is apparently choosing this index to avoid a
sort, because of the mis-estimation on the number of rows. Is it
critical that the rows be returned in that order? If not, you might
see much faster performance by leaving off the ORDER BY clause so
that it can use the seqscan.

You could potentially make queries like this much faster by indexing
on channel_id, or by indexing on data_id WHERE channel_id =
'sale_transaction'..

You could also set up optimization barriers with clever use of a CTE
or an OFFSET 0 to force it to use a seqscan followed by a sort, but
I would look at the other options first.

-Kevin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message tuanhoanganh 2011-08-06 02:16:12 Re: PostgreSQL 9.0.1 on Windows performance tunning help please
Previous Message Shaun Thomas 2011-08-05 17:09:57 Re: Postgres 8.4 memory related parameters