Don't use distinct command.It performance way is slow. group by command performance very high compare to distinct command.Please see the real time difference in the below example query.
1) select count(*) from (select distinct contact_id from contacts_lists) a;
count
65474
1 row(s)
Total runtime: 40,800.186 ms
2) select count(*) from (select contact_id from contacts_lists group by contact_id) a;
count
65474
1 row(s)
Total runtime: 32,302.381 ms
No comments:
Post a Comment