Re: Slow query

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To:
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Slow query
Date: 2003-01-23 14:43:29
Message-ID: 3E2FFF91.7020700@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ricardo Javier Aranibar León wrote:
> I run Explain and this is the result:
> EXPLAIN SELECT * from simon where fecha='20030122' order by hora desc;
> NOTICE: QUERY PLAN:
> Sort (cost=57700.73..57700.73 rows=23682 width=46)
> -> Seq Scan on simon (cost=0.00..55591.05 rows=23682 width=46)
>
> and when I run explain for another table this is te result:
> EXPLAIN SELECT * from llamada where fecha='20030122' order by hora desc;
> NOTICE: QUERY PLAN:
> Sort (cost=41102.70..41102.70 rows=12413 width=82)
> -> Index Scan using fecha_lla on llamada (cost=0.00..39944.95
> rows=12413 width=82)

I'm not sure if there is much to help. You have a lots of rows in result -
23k rows and 12k rows. The problem is in output, not in query or indexing.

Do you really use such queries?
Anyway, did you vaccum analyze before testing?

Regards,
Tomasz Myrta

In response to

  • Slow query at 2003-01-23 14:16:17 from Ricardo Javier Aranibar León

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-01-23 15:30:00 Re: calling function from rule
Previous Message Ricardo Javier Aranibar León 2003-01-23 14:16:17 Slow query