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: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 12 Sep 2005 00:13:42 -0700
Message-ID: <43252aa6$1@news.victoria.tc.ca>


juhunu_at_gmail.com wrote:
: Whenever I use a DISTINCT in my query, I see the "SORT UNIQUE" getting
: added to the execution plan.

: "SORT UNIQUE" is increasing the cost of the query by a greater factor.

: Any help in reducing the cost in using DISTINCT would be of much help.

: Thanks in Advance.

It's hard for a program to get distinct values without having a sorted list available. How else will it determine whether a value is distinct or not? E.g. the way to get a unique list of lines in unix is typically to "sort file | uniq" .

Having an index that is already a sorted list of the desired values would presumably help.

--

This programmer available for rent.
Received on Mon Sep 12 2005 - 02:13:42 CDT

Original text of this message

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