Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Why DISTINCT is costly?

Re: Why DISTINCT is costly?

From: Robert Klemme <bob.news_at_gmx.net>
Date: Mon, 12 Sep 2005 14:47:11 +0200
Message-ID: <3olbmlF61id4U1@individual.net>


sim wrote:
> A group by is not always the better choice but in most cases you can
> see it's better when you look at the explain plan of your query.
> Here's an example:

<snp/>

> Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
>
> SELECT STATEMENT Optimizer Mode=ALL_ROWS 8 K 26,6206304779564
>
> SORT GROUP BY 8 K 733 K 26,6206304779564
> EXTERNAL TABLE ACCESS FULL DWH_REA.EXT_TDVC_VERTRAG 8 K 733
> K 24,4384919334481
>
>
> Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
>
> SELECT STATEMENT Optimizer Mode=ALL_ROWS 8 K 201,302378376216
>
> SORT UNIQUE 8 K 733 K 201,302378376216
> EXTERNAL TABLE ACCESS FULL DWH_REA.EXT_TDVC_VERTRAG 8 K 733
> K 24,4384919334481

There's not much difference in those plans. Do you have an explanation why SORT GROUP BY is cheaper than SORT UNIQUE in this case? Thx!

Kind regards

    robert Received on Mon Sep 12 2005 - 07:47:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US