Skip site navigation (1) Skip section navigation (2)

Re: Same query doing slow then quick

From: Julien Cigar <jcigar(at)ulb(dot)ac(dot)be>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Same query doing slow then quick
Date: 2012-09-26 13:21:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On 09/26/2012 15:03, FFW_Rude wrote:
> Here is the answer to Ray Stell who send me the wiki page of Slow Query. I
> hope i detailed all you wanted (i basicly pasted the page and add my
> answers).
> Full Table and Index Schema:
> schema tables_adresses
> "Tables"
> tables_adresses.adresses_XX (id (serial), X(Double precision),Y (Double
> precision)).
> "Indexes"
> adresses_XX_pkey (Primary key, btree)
> calcul_XX (non unique, Btree on X,Y)
> schema tables_gps
> "Tables"
> tables_gps.gps_XX (id (int),x_max(numeric(10,5)), y_max
> (numeric(10,5)),x_min(numeric(10,5)),y_min(numeric(10,5)))
> "Indexes"
> calculs_XX (non unique Btree x_min,x_max,y_min,y_max)
> gps_10_pkey (Primary key on id btree)
> Approximate rows 250000.
> No large objects in it (just data)
> receives a large number of UPDATEs or DELETEs regularly
> is growing daily
> I can't post an EXPLAIN ANALYZE because of the 6hour query time.
> Postgres version: 9.1
> History: was this query always slow, : "YES"
> Hardware: Ubuntu server last version 32bits
> Daily VACUUM FULL ANALYZE, REINDEX TABLE on all the tables.
> WAL Configuration: Whats a WAL ?
> GUC Settings: i didn't change anything. All is standard.
> shared_buffers should be 10% to 25% of available RAM (it's on 24MB and can't
> go higher. The server has 4Gb)
> effective_cache_size should be 75% of available RAM =>  I don't now what this
> is.

before looking further, please configure shared_buffers and 
effective_cache_size properly, it's fundamental
you'll probably need to raise SHMALL/SHMMAX, take a look at:
for 4GB of RAM I start with shared_buffers to 512MB and 
effective_cache_size to 2GB

> Test changing work_mem: increase it to 8MB, 32MB, 256MB, 1GB. Does it make a
> difference? "No"

default work_mem is very small, set it to something like 16MB

> --
> View this message in context:
> Sent from the PostgreSQL - performance mailing list archive at

No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.

Attachment: jcigar.vcf
Description: text/x-vcard (292 bytes)

In response to


pgsql-performance by date

Next:From: FFW_RudeDate: 2012-09-26 13:36:45
Subject: Re: Same query doing slow then quick
Previous:From: FFW_RudeDate: 2012-09-26 13:03:49
Subject: Re: Same query doing slow then quick

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group