pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eyal Wilde <eyal@impactsoft.co.il>
To: pgsql-performance@postgresql.org
Subject: Re: scale up (postgresql vs mssql)
Date: Thu, 3 May 2012 20:07:55 +0300
Message-ID: <CAMiEbch3b1zTEASn5+geGXivb_BNPvZ1VnxQ_yLS-RParM35Hw@mail.gmail.com> (raw)
In-Reply-To: <CAHyXU0w8pqSArePOdwKxf8DfvPZ_uPayngGx1_4PC3kPJ+7CVw@mail.gmail.com>
References: <CAMiEbcj7LF56GiC8BTJbfku-TikaAqoAEY9kZtSfYKoj4Ntvew@mail.gmail.com>
	<CAHyXU0w8pqSArePOdwKxf8DfvPZ_uPayngGx1_4PC3kPJ+7CVw@mail.gmail.com>

guess what:

after reducing bo (blocks out) to ~10% by using a ramdisk (improving
overall performance by ~15-20%), i now managed to reduced it to ~3% by ....
removing the "analyze temp-table" statements.
it also :
reduced b (Process which are waiting for I/O) to zero
reduced wa (percentage of time spent by cpu for waiting to IO) to zero
and reduced id (cpu idle time percent) to be 4 times less.

r b swpd free buff cache si so bi bo in cs us sy id wa st
8 0 0 6144048 237472 485640 0 0 0 40 4380 3237 79 5 16 0 0
8 0 0 6138216 238032 485736 0 0 0 40 4741 3506 93 7 0 0 0
8 0 0 6125256 238276 486484 0 0 0 2709 4801 3447 92 7 1 0 0
7 0 0 6119400 238376 485792 0 0 0 32 4854 4311 93 6 1 0 0
5 0 0 6105624 238476 486172 0 0 0 364 4783 3430 92 7 1 0 0
5 0 0 6092956 238536 485384 0 0 0 416 4954 3652 91 8 2 0 0


unfortunately, this time there was no significant performance gain. ):

i afraid now there are certain statements that do not use an optimal
query-plan. these statements looks like:
insert into temp-table1 (value) select table1.f1 from table1 join
temp-table2 on table1.recid=temp-table2.recid where table1.f2 in (x,y,z);
temp-table2 never contains more then 10 records.
there is an index on table1: recid,f2
previous tests showed that the query-optimizer normally chose to do
hash-join (i.e: ignoring the index), but once we did "analyze
temp-table2;", the index was used. i read somewhere that the optimizer's
assumption is that every temp-table contains 1k of records. i believe that
is the reason for the bad plan. we tried to do "set
enable_hashjoin=false;", but it did not seem to be working inside a
function (although it did work independently). what can we do about that?

another thing i found is that a sequence on a temp-table is being stored on
the current tablespace, and not on the temp_tablespace. would you consider
this as a bug?
anyway, i found a way to not using any sequences on the temp-tables. but
this did not change the bo (blocks-out) figures.

merlin,
about the Hint Bits. i read this article:
http://wiki.postgresql.org/wiki/Hint_Bits
as far as i understand, this is not the case here, because i ran the test
many times, and there were no DML operations at all in between. so i
believe that the hint-bits are already cleared in most of the tuples.

Thanks again for any more help.

view thread (24+ messages)  latest in thread

Message-ID: <CAMiEbch3b1zTEASn5+geGXivb_BNPvZ1VnxQ_yLS-RParM35Hw@mail.gmail.com>
Permalink:  ../CAMiEbch3b1zTEASn5+geGXivb_BNPvZ1VnxQ_yLS-RParM35Hw@mail.gmail.com/
Also on:    postgresql.org/message-id/CAMiEbch3b1zTEASn5+geGXivb_BNPvZ1VnxQ_yLS-RParM35Hw@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: eyal@impactsoft.co.il
  Subject: Re: scale up (postgresql vs mssql)
  In-Reply-To: <CAMiEbch3b1zTEASn5+geGXivb_BNPvZ1VnxQ_yLS-RParM35Hw@mail.gmail.com>
  References: <CAMiEbcj7LF56GiC8BTJbfku-TikaAqoAEY9kZtSfYKoj4Ntvew@mail.gmail.com> <CAHyXU0w8pqSArePOdwKxf8DfvPZ_uPayngGx1_4PC3kPJ+7CVw@mail.gmail.com> <CAMiEbch3b1zTEASn5+geGXivb_BNPvZ1VnxQ_yLS-RParM35Hw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox