Re: Select query

Re: Select query

 

  


The selectivity of a large in-list (more than about 8 items) would probably
cause a full-table scan.

A better way to do this would be to generate something like this:

WITH possible_values (vals) AS
( VALUES
'val1'
, 'val2'
, 'val3'
, ...
)
SELECT
table_name.*
FROM
table_name,
possible_values
WHERE
col_name = vals
;


Best Regards,
Raanon Reutlinger

IBM Certified IT/SW Specialist
Data Management Technical Sales Specialist, IBM Israel
94 Derech Em-Hamoshavot, Kiryat Arie, Petach-Tikva 49527
Tel: +972-(0)3-918-8690; Fax: +972-(0)3-918-8840;
E-mail: [Email address protected]
http://www.ibm.com/il/software http://www.ibm.com/software/data/db2



"amit kamath /
Kotak /
Securities " To
<db2udbdba-ezmlms "LazyDBA Discussion"
hield-x1976887.x1 <[Email address protected]
[Email address protected] cc
.com>
Subject
20/05/2004 08:05 Select query










Hi Experts,

I have a query which is like select * from table_name where col_name in
('','','','',)
I want to know how many values can be passed to this query, I mean in the
in
clause.
My program may pass around 5000 values but I want to know the max values.

Thanks in advance,
Amit.


---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe, e-mail: db2udbdba-[Email address protected]
For additional commands, e-mail: db2udbdba-[Email address protected]





DB2 & UDB email list listserv db2-l LazyDBA home page