Hi all,
which one has the better performance between "GROUP BY" and "DISTINCT"?
I need to retrieve a distinct value of a specific column. Either "GROUP BY"
and "DISTINCT" could be finish that.
But I want to know which one has the better performance. Or I can use
another sql command to finish that with best performance.
Here is the dummy script
Create Table foo(id INTEGER PRIMARY KEY AUTOINCREMENT, x TEXT);
create index idx_foo on foo(x);
insert into foo(x) values('text001');
:
:
insert into foo(x) values('text300');
SELECT Distinct x from foo;
or
SELECT x from foo group by x;
or
others.
Would you please help to tell me how to improve that?
Thanks for your great help.
Thanks,
VK