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

Home -> Community -> Usenet -> c.d.o.server -> Re: Select max fro a table!

Re: Select max fro a table!

From: <Markz_at_starnet.lenfest.com>
Date: Fri, 29 Jan 1999 17:01:45 GMT
Message-ID: <36b1e7c7.603719823@news1.fast.net>


Then this begs the question :
Why does Oracle(7.3.4) do a sort on a full scan of the index (as shown in Explain Plan.) ?
On Thu, 28 Jan 1999 21:04:39 -0000, "Jonathan Lewis" <jonathan_at_jlcomp.demon.co.uk> wrote:

>In a b-tree, an index block has a directory listing which orders the
>index entries. The following fragment of an Oracle 8 block dump
>illustrates the idea:
>
>row#0[1848] flag: ----, lock: 2, data:(6): 01 40 09 90 00 01
>col 0; len 3; (3): 41 41 41
>row#1[1860] flag: ----, lock: 2, data:(6): 01 40 09 90 00 00
>col 0; len 3; (3): 43 43 43
>row#2[1836] flag: ----, lock: 2, data:(6): 01 40 09 90 00 02
>col 0; len 3; (3): 45 45 45
>
>The table was created with a varchar2() index.
>I inserted 3 rows, with index values 'CCC','AAA','EEE' in that order.
>
>As you can see from the block dump, the
> 'CCC' row starts at the top of the block - byte 1860
> 'AAA' starts just below is at byte 1848
> 'EEE' starts below that at byte 1836
>
>The entries are packed into clean blocks at the next available space,
>and space is made wherever possible in dirty blocks.
>
>However, the directory, basically a list of pointers at the start of the
>block
>is constantly shuffled so that an ordered walk through the directory returns
>the rows in index order: as you can see
> row #0 is 'AAA'
> row #1 is 'CCC'
> row #2 is 'EEE'
>
>Jonathan Lewis
>Yet another Oracle-related web site: www.jlcomp.demon.co.uk
>
>
>
>
>Markz_at_starnet.lenfest.com wrote in message
><36b0be81.527617523_at_news1.fast.net>...
>>Most likely, the index is unordered. Given a key, it will return the
>>physical location of the record via some hash function or tree
>>traversal, however it need not be ordered in the way you
>>might expect.
>>
>
>
>

MarK Z, 6b, rhymingly Received on Fri Jan 29 1999 - 11:01:45 CST

Original text of this message

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