Re: Optimizing a request

From: Hervé Piedvache <footcow(at)noos(dot)fr>
To: Jean-Max Reymond <jmreymond(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimizing a request
Date: 2004-08-31 20:41:15
Message-ID: 200408312241.15315.footcow@noos.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

Le Mardi 31 Août 2004 20:59, Jean-Max Reymond a écrit :
> explain SELECT art_id, art_titre, art_texte, rub_titre
> FROM article inner join rubrique on article.rub_id = rubrique.rub_id
> where rub_parent = 8;
>
> Hash Join (cost=8.27..265637.59 rows=25 width=130)
> Hash Cond: ("outer".rub_id = "inner".rub_id)
> -> Seq Scan on article (cost=0.00..215629.00 rows=10000000 width=108)
> -> Hash (cost=8.26..8.26 rows=3 width=22)
> -> Index Scan using rubrique_parent on rubrique
> (cost=0.00..8.26 rows=3 width=22)
> Index Cond: (rub_parent = 8)
>

What are the values in rub_parent ... is their many disparity in the values ?
May be you have most of the value set to 8 ... and may be the optimizer think
a seq scan is better than the use of an index ...

Could you do a simple :
SELECT rub_parent, count(rub_id)
FROM rubrique
GROUP BY rub_parent;

Just to see the disparity of the values ...

regards,
--
Bill Footcow

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message jelle 2004-08-31 21:20:41 Re: Context Switching issue: Spinlock doesn't fix.
Previous Message Gary Doades 2004-08-31 20:31:44 Re: Optimizing a request