Re: ORDER BY costs

From: Carlos Benkendorf <carlosbenkendorf(at)yahoo(dot)com(dot)br>
To: Jan Dittmer <jdittmer(at)sfhq(dot)hn(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: ORDER BY costs
Date: 2005-12-22 16:23:36
Message-ID: 20051222162336.8347.qmail@web35502.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


Jan Dittmer <jdittmer(at)sfhq(dot)hn(dot)org> escreveu: What is your work_mem setting? I think the default is 1MB which is
probably too low as your trying to sort roughly 150000*100Bytes = 15MB.

Jan

I think you would like to say 150000*896Bytes... Am I right? My default work_mem is 2048 and I changed to 200000... and pgsql_tmp directory is not used any more...but...

Now the new numbers:

Sort (cost=132929.22..133300.97 rows=148701 width=896) (actual time=3949.663..4029.618 rows=167710 loops=1)
Sort Key: anocalc, cadastro, codvencto, parcela
-> Index Scan using pk_arript, pk_arript, pk_arript, pk_arript on arript (cost=0.00..120154.28 rows=148701 width=896) (actual time=0.166..829.260 rows=167710 loops=1)
Index Cond: (((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto = 0::numeric) AND (parcela >= 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro = 19::numeric) AND (codvencto > 0::numeric)) OR ((anocalc = 2005::numeric) AND (cadastro > 19::numeric)) OR (anocalc > 2005::numeric))
Total runtime: 4184.723 ms
(5 rows)


It is less than with work_mem set to 2000 but is it worthly? I´m afraind of swapping... are not those settings applied for all backends?

Benkendorf


---------------------------------
Yahoo! doce lar. Faça do Yahoo! sua homepage.

Browse pgsql-performance by date

  From Date Subject
Next Message Juan Casero 2005-12-23 02:44:32 Re: MySQL is faster than PgSQL but a large margin in
Previous Message Steve Peterson 2005-12-22 15:23:49 Re: effizient query with jdbc