470,631 Members | 1,704 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,631 developers. It's quick & easy.

Query help

Raj
Hi all,

The following query does a table scan, it is only selecting 10% of
tab1's data. It has a clustered index on dt column (not-MDC) and
cluster ratio is 93%

Card of tab1 - 1175070690
Card of tab2 - 100000

Query: ( Tablescan)
select [10-columns] from tab1 where dt >= (select min(dt) from tab2)
Query:( uses the index on dt)
select [10-columns] from tab1 where dt >= (select char(min(dt)) from
tab2)

Actual query:
select .......
(
select .......
union all
select [10-columns] from tab1 where dt >= (select char(min(dt)) from
tab2)
union all
select .......
)
group by .....
Why does the optimizer use the index on the dt column in the second
case??? It also runs faster...

Thanks,
Raj

Aug 4 '06 #1
2 1036
What is the data type of dt?

Aug 5 '06 #2
Raj
Both are of datatype date...
Tonkuma wrote:
What is the data type of dt?
Aug 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by netpurpose | last post: by
7 posts views Thread by Simon Bailey | last post: by
36 posts views Thread by Liam.M | last post: by
4 posts views Thread by Doris | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.