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
97331
July 05, 2005 07:23PM
28763
July 05, 2005 07:37PM
22392
July 06, 2005 05:44AM
19291
July 07, 2005 06:13AM
17264
July 07, 2005 09:11AM
17307
July 07, 2005 10:48AM
9998
July 07, 2005 10:51AM
8824
July 08, 2005 05:27AM
9928
July 08, 2005 05:48AM
8117
August 19, 2005 05:22AM
8982
July 06, 2005 02:11AM
Re: select count(distinct)
8310
July 06, 2005 05:33AM
7335
July 06, 2005 06:13PM
7277
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.