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: count(*) - sample block

Re: count(*) - sample block

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 08 Dec 2006 14:58:28 -0800
Message-ID: <1165618695.669678@bubbleator.drizzle.com>


Andy Hassall wrote:
> On 8 Dec 2006 13:43:33 -0800, "prateek" <hkprateek_at_gmail.com> wrote:
>

>> I am curious to know why this query:
>>
>> "select count(*) from far_employee sample block (1);"
>>
>> returns zero at times and some other times returns a non zero number.
>> Table: far_employee is populated with more than 400K records.

>
> The blocks sampled probably contained no rows, i.e. they are below the HWM for
> the table, but not currently populated.

You may be correct ... but it seems unlikely. If sampling is a percentage ... then 1% should sample 1% of the blocks. I have a table I ran some tests on with 1056 blocks created with CREATE TABLE AS ... and SAMPLE BLOCK(1) consistently returns zero. Seems unlikely with a CTAS just as it seems unlikely that 10 blocks (1%) are unpopulated. I could get in their with DBMS_ROWID and find out for sure but it is Friday ... and I'm heading for a glass of scotch.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Fri Dec 08 2006 - 16:58:28 CST

Original text of this message

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