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: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 3 Oct 2005 16:22:02 -0700
Message-ID: <4341bd1a$1@news.victoria.tc.ca>


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?

The DISTINCT probably does slow it down, but not necessarily as much as your test implies.

In the distinct query the entire result set will have to have been determined before the distinctness of each row can be confirmed, and therefore no data can be sent until the entire query has been run.

Contrast that with the non-distinct query which can start returning rows immediately. It can starts the display more quickly, but it may well take almost the same _elasped_ time to return all the data.

--

This programmer available for rent.
Received on Mon Oct 03 2005 - 18:22:02 CDT

Original text of this message

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