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: DISTINCT as a way to slow down queries

Re: DISTINCT as a way to slow down queries

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Mon, 03 Oct 2005 22:22:48 +0200
Message-ID: <nl43k1daee3u50q5vg7je01evp5grj86ad@4ax.com>


On 3 Oct 2005 12:10:50 -0700, "cumin" <jkilbourne_at_gmail.com> wrote:

>I just ran a query, SELECT blah blah, and had to hit Ctrl-C as the
>results flew by; 6000 rows of the same two values. So I added DISTINCT
>to the front, and I am still waiting for results 10 minutes later. Why
>does DISTINCT have such a dramatic effect on performance?

DISTINCT will guarantee every row returned is unique. Consequently Oracle will perform a SORT UNIQUE operation on the *entire* resultset. You can of course tune your sort operations, but a sort is what you are going to get because of your DISTINCT.

--
Sybrand Bakker, Senior Oracle DBA
Received on Mon Oct 03 2005 - 15:22:48 CDT

Original text of this message

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