My table has 2 million records. I want to select distinct values from the table. If I use select distinct... it may take more time. What would be another option to select distinct values in less time.
Asked
Active
Viewed 192 times
3 Answers
0
If you've done proper indexing, then SELECT DISTINCT should be the fastest way here.

Gregor Menih
- 5,036
- 14
- 44
- 66
0
GROUP BY? or having another table with just distinct values modified by triggers on insert, delete, update to the original table?

rezna
- 2,243
- 2
- 17
- 16
0
If you want to select distinct, you have to select distinct.
Here are few things you can do to make it faster:
- Index the columns you are selecting distinct upon.
- Use a clustered index if possible.
- Partition your data so make searching faster.
2 million rows is big but not at all unheard of for a database.

nunespascal
- 17,584
- 2
- 43
- 46