question

pavithra_vs avatar image
pavithra_vs asked

can you please suggest how to optimize this query : select a.col1,a.col2,count(b.col1) as cnt from table1 a,table2 b where b.col2 between a.col1 and a.col2 group by a.col1,a.col2

can you please suggest how to optimize this query : select a.col1,a.col2,count(b.col1) as cnt from table1 a,table2 b where b.col2 between a.col1 and a.col2 group by a.col1,a.col2
group-byoptimizationwherebetween
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

borispinsky avatar image
borispinsky answered
Look at your ex.plan and set statists io on to see with table has the most logical reads
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

vvvtrain avatar image
vvvtrain answered
your understanding of the requirement must be wrong. Try to understand what result you need to generate.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.