pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Hannu Krosing <hannu@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Peter Hussey <peter@labkey.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: Questions on query planner, join types, and work_mem
Date: Wed, 04 Aug 2010 14:00:36 -0400
Message-ID: <22961.1280944836@sss.pgh.pa.us> (raw)
In-Reply-To: <1280944268.3735.12.camel@hvost>
References: <AANLkTikMwVZKDYLitnsK31R=VNOuTH8NtmDHDGkBR7k8@mail.gmail.com>
	<18551.1280275502@sss.pgh.pa.us>
	<AANLkTimXMR0jMdw+66E4Xx=SqNV37Ne9WfkFjPFZVjbV@mail.gmail.com>
	<25534.1280498632@sss.pgh.pa.us>
	<AANLkTik3oY1=F_uC843c84LxBLNdHxZaWdfjxrAtyBeu@mail.gmail.com>
	<1280819031.14579.38.camel@hvost>
	<AANLkTik6UBt2ezVFzdCM8iaUPkra_7f-Hs_AmGZgvFhh@mail.gmail.com>
	<1280944268.3735.12.camel@hvost>

Hannu Krosing <hannu@2ndquadrant.com> writes:
> Of course there are more variables than just *_page_cost, so if you nail
> down any other one, you may end with less than 1 for both page costs.

> I have always used seq_page_cost = 1 in my thinking and adjusted others
> relative to it.

Right, seq_page_cost = 1 is sort of the traditional reference point,
but you don't have to do it that way.  The main point here is that for
an all-in-RAM database, the standard page access costs are too high
relative to the CPU effort costs:

regression=# select name, setting from pg_settings where name like '%cost';
         name         | setting 
----------------------+---------
 cpu_index_tuple_cost | 0.005
 cpu_operator_cost    | 0.0025
 cpu_tuple_cost       | 0.01
 random_page_cost     | 4
 seq_page_cost        | 1
(5 rows)

To model an all-in-RAM database, you can either dial down both
random_page_cost and seq_page_cost to 0.1 or so, or set random_page_cost
to 1 and increase all the CPU costs.  The former is less effort ;-)

It should be noted also that there's not all that much evidence backing
up the default values of the cpu_xxx_cost variables.  In the past those
didn't matter much because I/O costs always swamped CPU costs anyway.
But I can foresee us having to twiddle those defaults and maybe refine
the CPU cost model more, as all-in-RAM cases get more common.

			regards, tom lane



view thread (32+ messages)  latest in thread

Message-ID: <22961.1280944836@sss.pgh.pa.us>
Permalink:  ../22961.1280944836@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22961.1280944836@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hannu@2ndquadrant.com, robertmhaas@gmail.com, peter@labkey.com
  Subject: Re: Questions on query planner, join types, and work_mem
  In-Reply-To: <22961.1280944836@sss.pgh.pa.us>

* 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