| From: | Shaun Thomas <sthomas(at)townnews(dot)com> |
|---|---|
| To: | Varun Kacholia <varunk(at)cse(dot)iitb(dot)ac(dot)in> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Highly obscure and erratic |
| Date: | 2002-06-19 14:35:57 |
| Message-ID: | Pine.LNX.4.44.0206190931560.16252-100000@hamster.lee.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Wed, 19 Jun 2002, Varun Kacholia wrote:
> 1. SELECT * FROM dbmedia WHERE ID IN ((SELECT id FROM wdmedia WHERE
> word = 'whatever') ) LIMIT 20;
You probably didn't know this, but postgres is notorious for being
*very* bad at optimizing IN queries. Try this instead:
SELECT * FROM dbmedia d WHERE EXISTS
(SELECT 1 FROM wdmedia w WHERE w.id = d.id AND word = 'whatever')
LIMIT 20;
--
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Shaun M. Thomas INN Database Administrator |
| Phone: (309) 743-0812 Fax : (309) 743-0830 |
| Email: sthomas(at)townnews(dot)com AIM : trifthen |
| Web : www.townnews.com |
| |
| "Most of our lives are about proving something, either to |
| ourselves or to someone else." |
| -- Anonymous |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shaun Thomas | 2002-06-19 14:39:42 | Re: Highly obscure and erratic |
| Previous Message | Shaun Thomas | 2002-06-19 14:30:23 | Re: db grows and grows |