TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hakan Axheim
NA
201
32.4k
Regarding performance
Sep 16 2019 1:02 AM
Hi,
Back in the old days they said that you should never use select distinct from a database, because the optimizer cannot use index. I want to know if it is some difference in performance between:
select distinct *
with cte as(
select col1,
row_number() over (partition by col1 order by col1) as DuplicateCount
from table1
)
select col1 from cte where DuplicateCount = 1;
select col1
from table1
group by col1
Maybe it is another way to write an sql statement with best performance regarding select distinct values from on one or more columns.
Reply
Answers (
1
)
How to get Highest Sales Person in Month for Monthly Reward
How to minimize runtime in a Query