Re: select count(distinct)
I checked the query and the correct "faster" query is select sum(one) from (select (1) as one from table group by col1) as f2.
I used the explain method and here are the results.
simple query: select distinct ...
1 |Simple | table | index | NULL | index_col1 | 8 | null | 12400000 | Using index
complicated but faster query: select sum(one) ...
1 | Primary | derived | ALL | NULL | NULL | NULL | NULL | 9400000
2 | Derived | table | index | NULL | index_col1 | 8 | null | 12400000 | Using index
Any explanations or interpretations?
Subject
Views
Written By
Posted
97048
July 05, 2005 07:23PM
28702
July 05, 2005 07:37PM
22337
July 06, 2005 05:44AM
19228
July 07, 2005 06:13AM
17205
July 07, 2005 09:11AM
17239
July 07, 2005 10:48AM
9946
July 07, 2005 10:51AM
8778
July 08, 2005 05:27AM
9888
July 08, 2005 05:48AM
8081
August 19, 2005 05:22AM
8938
July 06, 2005 02:11AM
Re: select count(distinct)
8269
July 06, 2005 05:33AM
7285
July 06, 2005 06:13PM
7232
July 07, 2005 05:14AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.