Unix Technical Forum

subqueries to temp table performance

This is a discussion on subqueries to temp table performance within the Informix forums, part of the Database Server Software category; --> Hello, I've got to run some queries (with subqueries) on quite large tables (each about 10 millions of rows). ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 10:27 PM
marcin
 
Posts: n/a
Default subqueries to temp table performance

Hello,
I've got to run some queries (with subqueries) on quite large tables (each
about 10 millions of rows).
The queries are in that pattern:
select col1,col2 from table 1
where id not in
(select ....)
and not in
(select ....)
and not in
(select ....)

There are proper indexes on tables, and statistics are correctly updated.
I'm looking for information how can I improve query performance.

Will creating temp tables for all subqueries be a good idea?
Or is there another way?

thanks
Marcin


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 10:27 PM
Fernando Nunes
 
Posts: n/a
Default Re: subqueries to temp table performance

marcin wrote:
> Hello,
> I've got to run some queries (with subqueries) on quite large tables (each
> about 10 millions of rows).
> The queries are in that pattern:
> select col1,col2 from table 1
> where id not in
> (select ....)
> and not in
> (select ....)
> and not in
> (select ....)
>
> There are proper indexes on tables, and statistics are correctly updated.
> I'm looking for information how can I improve query performance.
>
> Will creating temp tables for all subqueries be a good idea?
> Or is there another way?
>
> thanks
> Marcin
>
>


I would advise you not to use "in". But it really depends on what is the
" (select ....)"

Let's assume you just want to look for the id field in the tables used
in the subqueries. If that is the case an alternative might be create
just one temp table with that column and an index on it. So your query
would use only one sub-query.

Besides this, if you can avoid the "in" and use "EXISTS" it's usualy
better (make a co-related subquery, with index on what you're looking
for on the "interior" table.

Regards.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:14 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com