Re: Query planner unaware of possibly best plan

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Denes Daniel <panther-d(at)freemail(dot)hu>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query planner unaware of possibly best plan
Date: 2007-09-21 19:56:44
Message-ID: 20070921195644.GB13986@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Denes Daniel wrote:

> I've just inserted some newlines, so it's better to read than when my
> email-client wraps the lines automatically. Did not touch the information
> itself. But here is the normal output of EXPLAIN ANALYZE:

The best thing to do is paste them in a text file and send it as an
attachment.

> QUERY PLAN
> -------------------------------------------------------------------------------------------
> --------------------------------------------
> Sort (cost=100000132.10..100000140.10 rows=8 width=16) (actual
> time=0.302..0.319 rows=9 loops=1)
> Sort Key: tparent.ord, tchild.ord
> -> Nested Loop (cost=0.00..84.10 rows=8 width=16) (actual
> time=0.181..0.267 rows=9 loops=1)
> -> Index Scan using par_uniq_ord on tparent (cost=0.00..20.40
> rows=4 width=8) (actual time=0.100..0.109 rows=4 loops=1)
> Index Cond: ((ord >= 1) AND (ord <= 4))
> -> Index Scan using chi_pkey_parid_ord on tchild
> (cost=0.00..9.93 rows=2 width=8) (actual time=0.020..0.026 rows=2
> loops=4)
> Index Cond: (tchild.par_id = "outer".id)
> Total runtime: 0.412 ms
> (8 rows)
>
> The costs may be different because I've tuned the query planner's
> parameters.

Why did you set enable_sort=off? It's not like sorting 9 rows is going
to take any noticeable amount of time anyway.

--
Alvaro Herrera http://www.advogato.org/person/alvherre
"No hay hombre que no aspire a la plenitud, es decir,
la suma de experiencias de que un hombre es capaz"

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Denes Daniel 2007-09-21 20:05:29 Re: Query planner unaware of possibly best plan
Previous Message brauagustin-susc 2007-09-21 19:33:46 Re: Low CPU Usage