From: | "Mitch Vincent" <mitch(at)venux(dot)net> |
---|---|
To: | <pgsql-sql(at)postgreSQL(dot)org> |
Subject: | Sub-select speed. |
Date: | 1999-12-17 18:50:06 |
Message-ID: | 018301bf48bf$8a068620$0300000a@doot.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hey guys, I have a few queries here that I would greatly appreciate any
pointers on. I ned to get them as fast as possible but would settle for ANY
speed improvement over what it is now..
select * from applicants as a where a.status = 'A' and a.app_id in(select
b.app_id from resume_search as b where a.app_id=b.app_id and b.user_id=291)
resume_search is a table populated by a query before this one. The schema
is as follows :
| user_id | int4 |
4 |
| app_id | int4 |
4 |
Indices: resume_app_id
resume_search_id
So, in it's current form, with only a few (say 5) rows in resume_search,
it's still tking quite some time.
In addition to this, I have another query liek this one, only it inserts to
another table also..
insert into users_download_app (user_id,app_id) select app_id from
applicants where status = 'A' and app_id in(select b.app_id from
resume_search as b where app_id=b.app_id and b.user_id=291) limit 200
This one is so slow that it's unusable. (We're talking minutes here on my
Celeron 333 devel server).
I wish there was another way to get what I need to get done but the
sub-selects are the only way I can see doing it now. I have a feeling though
that there are some extra things that I might be able to do to get the same
results from the same tables, faster.
Thanks to one and all.
-Mitch
From | Date | Subject | |
---|---|---|---|
Next Message | admin | 1999-12-17 19:55:35 | indices on join |
Previous Message | Kyle | 1999-12-17 18:03:56 | simple sql select help |