pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Miroslav Šulc <miroslav.sulc@startnet.cz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: John Arbash Meinel <john@arbash-meinel.com>
Cc: PGSQL mailing list <pgsql-performance@postgresql.org>
Subject: Re: How to read query plan
Date: Sun, 13 Mar 2005 20:43:58 +0100
Message-ID: <423497FE.6040908@startnet.cz> (raw)
In-Reply-To: <18381.1110741354@sss.pgh.pa.us>
References: <42345D24.8070104@startnet.cz>
	<4234692E.3050802@arbash-meinel.com>
	<42347407.2000202@startnet.cz>
	<423478B1.7080106@arbash-meinel.com>
	<18381.1110741354@sss.pgh.pa.us>

Tom Lane wrote:

>John Arbash Meinel <john@arbash-meinel.com> writes:
>  
>
>>How about a quick side track.
>>Have you played around with your shared_buffers, maintenance_work_mem,
>>and work_mem settings?
>>    
>>
>
>Indeed.  The hash joins seem unreasonably slow considering how little
>data they are processing (unless this is being run on some ancient
>toaster...).  One thought that comes to mind is that work_mem may be
>set so small that the hashes are forced into multiple batches.
>  
>
I've just tried to uncomment the settings for these parameters with with 
no impact on the query speed.

shared_buffers = 48000          # min 16, at least max_connections*2, 
8KB each
work_mem = 1024         # min 64, size in KB
maintenance_work_mem = 16384    # min 1024, size in KB
max_stack_depth = 2048          # min 100, size in KB

>Another question worth asking is what are the data types of the columns
>being joined on.  If they are character types, what locale and encoding
>is the database using?
>  
>
I have checked this and there are some JOINs smallint against integer. 
Is that problem? I would use smallint for IDPKs of some smaller tables 
but the lack of SMALLSERIAL and my laziness made me use SERIAL instead 
which is integer.

>That cost would be paid during the bottom-level scans though.  The thing
>that strikes me here is that nearly all of the cost is being spent
>joining.
>  
>
>>What version of postgres are you using?
>>    
>>
>
>And what's the platform (hardware and OS)?
>  
>
I've already posted the hardware info. OS is Linux (Gentoo) with kernel 
2.6.11.

>			regards, tom lane
>  
>
Miroslav

Attachments:

miroslav.sulc.vcf (text/x-vcard, 385B) download begin:vcard fn;quoted-printable:Miroslav =C5=A0ulc n;quoted-printable:=C5=A0ulc;Miroslav org:StartNet s.r.o. adr;quoted-printable;quoted-printable:;;Vrchlick=C3=A9ho 161/5;Praha 5;;150 00;=C4=8Cesk=C3=A1 republika email;internet:miroslav.sulc@startnet.cz title:CEO tel;work:+420 257 225 602 tel;cell:+420 603 711 413 x-mozilla-html:TRUE url:http://www.startnet.cz version:2.1 end:vcard

view thread (37+ messages)  latest in thread

Message-ID: <423497FE.6040908@startnet.cz>
Permalink:  ../423497FE.6040908@startnet.cz/
Also on:    postgresql.org/message-id/423497FE.6040908@startnet.cz

 · 

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: miroslav.sulc@startnet.cz, tgl@sss.pgh.pa.us, john@arbash-meinel.com
  Subject: Re: How to read query plan
  In-Reply-To: <423497FE.6040908@startnet.cz>

* 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