| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Oskar Liljeblad <osk(at)hem(dot)passagen(dot)se> | 
| Cc: | pgsql-sql(at)postgreSQL(dot)org | 
| Subject: | Re: [SQL] query with subquery abnormally slow? | 
| Date: | 1999-11-01 22:10:28 | 
| Message-ID: | 2748.941494228@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
Oskar Liljeblad <osk(at)hem(dot)passagen(dot)se> writes:
> I'm doing a SELECT query with a subquery on a table with 12K rows
> but it is very slow (10 seconds+). The query looks like this:
>   select *
>     from items
>     where package in
>       (select package
>          from items
>          where ...blah...
>          group by package)
Have you considered something like
select i1.* from items i1, items i2 where
i1.package = i2.package and i2.performer ~ '...';
This would only be fast given an index on package, I think,
but you said you had one...
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | omid omoomi | 1999-11-02 00:42:30 | Re: Antw: [SQL] query with subquery abnormally slow? | 
| Previous Message | Oskar Liljeblad | 1999-11-01 20:36:53 | Re: [SQL] query with subquery abnormally slow? |