From: | Ruben Rubio <ruben(at)rentalia(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Optimization of this SQL sentence |
Date: | 2006-10-17 09:05:35 |
Message-ID: | 45349CDF.3090002@rentalia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This SQL sentence is very simple. I need to get better results. I have
tried some posibilities and I didn't get good results.
SELECT max(idcomment)
FROM ficha vf
INNER JOIN comment c ON (vf.idficha=c.idfile AND (idestado=3 OR
idestado=4))
WHERE idstatus=3
AND ctype=1
QUERY PLAN
Aggregate (cost=2730.75..2730.76 rows=1 width=4) (actual
time=188.463..188.469 rows=1 loops=1)
-> Hash Join (cost=1403.44..2730.72 rows=11 width=4) (actual
time=141.464..185.404 rows=513 loops=1)
Hash Cond: ("outer".idfile = "inner".idficha)
-> Seq Scan on "comment" c (cost=0.00..1321.75 rows=1083
width=8) (actual time=0.291..36.112 rows=642 loops=1)
Filter: ((idstatus = 3) AND (ctype = 1))
-> Hash (cost=1403.00..1403.00 rows=178 width=4) (actual
time=141.004..141.004 rows=6282 loops=1)
-> Seq Scan on ficha vf (cost=0.00..1403.00 rows=178
width=4) (actual time=0.071..97.885 rows=6282 loops=1)
Filter: (((idestado)::text = '3'::text) OR
((idestado)::text = '4'::text))
Total runtime: 188.809 ms
Thanks in advance,
Ruben Rubio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD4DBQFFNJzfIo1XmbAXRboRAgPRAJ99+S9wL21b+JN14bQbAoREFXYUcQCYpfEZ
p1MCcDMWqTxzSdtssUFWOw==
=rUHB
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory S. Williamson | 2006-10-17 09:21:58 | Re: Optimization of this SQL sentence |
Previous Message | Carlo Stonebanks | 2006-10-17 06:43:57 | Re: Performance Optimization for Dummies 2 - the SQL |