Home » SQL & PL/SQL » SQL & PL/SQL » how to remove distinct key word from the table (oracle10g)
how to remove distinct key word from the table [message #351123] Mon, 29 September 2008 06:53 Go to next message
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 Go to previous messageGo to next message
Frank
Messages: 7880
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 #351129 is a reply to message #351123] Mon, 29 September 2008 07:19 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
By Not storing the duplicate data.

Regards,
Rajat
Re: how to remove distinct key word from the table [message #351132 is a reply to message #351129] Mon, 29 September 2008 07:38 Go to previous messageGo to next message
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 #351136 is a reply to message #351132] Mon, 29 September 2008 07:51 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Better revise that checklist.
One line of comment for every 20 lines of code being too much? HA!
Re: how to remove distinct key word from the table [message #351137 is a reply to message #351132] Mon, 29 September 2008 07:53 Go to previous message
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
Previous Topic: Ned to capture timing statistics in a stored procedure
Next Topic: How to achieve this ?
Goto Forum:
  


Current Time: Sat Dec 03 18:08:40 CST 2016

Total time taken to generate the page: 0.04984 seconds