how to remove distinct key word from the table [message #351123] |
Mon, 29 September 2008 06:53  |
navneet_sharma
Messages: 70 Registered: September 2008 Location: New Delhi, India
|
Member |
|
|
Is distinct keyword in the query to fetch distinct records a performance bottleneck. I m using distinct to fetch records from table having 20 million records.will it put any impact on performance of query if yes then kindly suggest any alternative to remove distinct .
thanks in advance
navneet
|
|
|
Re: how to remove distinct key word from the table [message #351126 is a reply to message #351123] |
Mon, 29 September 2008 07:17   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
If you need a set of distinct records, then you will need to add the distinct keyword.
It's like asking 'is querying a large table bad for performance?'. The answer is: if you need to, then you have to, regardless of the consequences for performance
|
|
|
|
Re: how to remove distinct key word from the table [message #351132 is a reply to message #351129] |
Mon, 29 September 2008 07:38   |
navneet_sharma
Messages: 70 Registered: September 2008 Location: New Delhi, India
|
Member |
|
|
Actualy my question is that ,should we avoid distinct keyword and use some other logic to retrive distinct records.There is code release checklist in my company which says avoid distinct keyword,remove comments if they are more than 5% of overall line of code etc. out of curousity I asked the question.You can answer better.
Thanks and Regards,
Navneet
|
|
|
|
Re: how to remove distinct key word from the table [message #351137 is a reply to message #351132] |
Mon, 29 September 2008 07:53  |
rajatratewal
Messages: 507 Registered: March 2008 Location: INDIA
|
Senior Member |
|
|
As frank already told you when you have duplicate data
and you have to get the distinct then you can't think of performance in that.You can write that query in a different way
but it won't help much.
Please post a test case.
Create Table and some insert statements.
Regards,
Rajat
|
|
|