Manual de Explain analyze

From: Miguel <mmiranda(at)123(dot)com(dot)sv>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Manual de Explain analyze
Date: 2005-12-19 20:36:48
Message-ID: 43A719E0.4020803@123.com.sv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola listeros, donde podria encontrar un buen manual de como interpretar
el resultado del explain analize, por el momento solo se que si dice seq
scan es algo malo, deberia usar indices, por ejemplo este resultado de
una consulta de dos tablas esta como encriptado para mi:

SELECT COUNT(a.callingstationid) as clientes_nuevos
FROM stoptelephony a
INNER JOIN inventario_pines b
ON a.username = b.pin
WHERE b.pais = 'SV'
AND b.idproducto = 11
AND a.h323callorigin = 'originate'
GROUP BY a.callingstationid
HAVING MIN(a.h323disconnecttime::date)
BETWEEN '2005-01-11' AND '2005-11-30'

HashAggregate (cost=225200.38..225207.73 rows=420 width=21) (actual
time=612999.038..612999.299 rows=66 loops=1)
Filter: ((min((h323disconnecttime)::date) >= '2005-01-11'::date) AND
(min((h323disconnecttime)::date) <= '2005-11-30'::date))
-> Merge Join (cost=62605.01..210617.60 rows=1458278 width=21)
(actual time=46394.414..612993.878 rows=767 loops=1)
Merge Cond: (("outer".username)::text = "inner"."?column2?")
-> Index Scan using stoptelephonyusername2 on stoptelephony a
(cost=0.00..889953.92 rows=5840302 width=33) (actual
time=2167.230..607295.323 rows=335044 loops=1)
Filter: ((h323callorigin)::text = 'originate'::text)
-> Sort (cost=62605.01..63245.78 rows=256311 width=13) (actual
time=4705.801..4839.895 rows=175889 loops=1)
Sort Key: (b.pin)::text
-> Seq Scan on inventario_pines b (cost=0.00..39578.62
rows=256311 width=13) (actual time=1213.257..3678.157 rows=175280 loops=1)
Filter: (((pais)::text = 'SV'::text) AND (idproducto
= 11))
Total runtime: 613053.933 ms

La consulta de tarda un mundo, imposible poner algo asi para el gerente,
demasiado lento, pero no se como optimizarla
Gracias

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2005-12-19 20:42:10 Re: Manual de Explain analyze
Previous Message Jaime Casanova 2005-12-19 17:44:50 Re: Ayuda con arreglos