sql - DB2 query optimization; LIKE alternative -
bare me sql not strong point:
i'm looking wildcard search i'm noticing performance degradation on particular strings(those return large number filtering down few).
select tbl_1.key , tbl_1.userid , tbl_1.domain , tbl_2.* , tbl_3.* , tbl_4.* , tbl_1 , tbl_2 , tbl_3 , tbl_4 tbl_1.key = tbl_2.key , tbl_1.key = tbl_3.key , tbl_1.key = tbl_4.key , upper(tbl_1.userid) 'string%' , upper(tbl_1.domain) 'string%' , tbl_3.crit1 = '' , tbl_3.crit2 in ('') , tbl_4.crit3 = ''
essentially i'm returning individual profile based on email address , domain wildcards filtering. there's index on tbl_1 consisting of key, userid, , domain. i'm trying avoid table scan , use index'd fields. db2 not seem index supported. appreciated; thanks.
the upper() may problem...not sure db2 luw @ least in db2 ibm be. "right" way case insensitive search case insensitive collating sequence or derived index.
a derived index:
create index myindex on mytable (upper(userid))
on db2 ibm i, can use case insensitive collating sequence setting
set option srtseq = *langidshr
note, have have *langidshr set when issue create index myindex on mytable (userid)
, when doing select
.
Comments
Post a Comment