[中文]
Author:
fuyuncat
Source:
www.HelloDBA.com
Date:
2010-01-13 03:06:07
3. Converting to endpoint value
If we draw the histogram, the endpoint value should be x axis, and the endpoint number should be y axis. For those columns with histogram, oracle will convert their values to the data type of endpoint value, say, number. We will discuss how does the endpoint number and endpoint value be stored.
Endpoint Number
For Endpoint Number, I have concluded it in previous paper "Frequency or Height Balanced".
- In Frequency Histogram, the Endpoint Number is the accumunltive records number of the values in sequence. For example, there are 2 records are "1", 1 record is "2", 5 records are "3" ..., then, the correspond buckets' Endpoint Number are 2, 3(2+1), 8(3+5);
- In Height Balanced Histogram, the Endpoint Number is the number of average bucket. For example, value 1,2,3 are located in the 1st bucket; value 4 is a popular value, which occupied 2 buckets, who has been compressed as 1 bucket; value 5 is located in the 3rd bucket..., then, Endpoint Number of these 3 buckets are 1, 3(2+1), 4(3+1).
Endpoing Value
We can find the data type of endpoint value from the dictionary table histgrm$. It means all kinds of datatype will be converted to number finally.
SQL代码
- HELLODBA.COM>desc histgrm$
- Name Null? Type
- ------------- -------- -------------------------------------
- OBJ# NOT NULL NUMBER
- COL# NOT NULL NUMBER
- ROW# NUMBER
- BUCKET NOT NULL NUMBER
- ENDPOINT NOT NULL NUMBER
- INTCOL# NOT NULL NUMBER
- EPVALUE VARCHAR2(1000)
- SPARE1 NUMBER
- SPARE2 NUMBER
Let's look into the conversion one datatype by one.
Note: Data precision to be analyzed for creating histogram is not same as the endpoint value data precision, which will also be discussed below.
Let's prepare the test data first.
SQL代码
- HELLODBA.COM>create table demo.htc3 (a number, b date, c raw(100), d varchar2(100), e clob, f rowid);
- Table created.
- HELLODBA.COM>insert into demo.htc3 values (1, to_date('2010-12-07 00:00:01', 'YYYY-MM-DD HH24:MI:SS'), '01', 'A', 'A', 'AAAxdYAAFAAAPJUAAA');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (2, to_date('2010-12-07 00:00:02', 'YYYY-MM-DD HH24:MI:SS'), '02', 'BB', 'B','AAAxdYAAFAAAPJUAAB');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (3, to_date('2010-12-07 00:00:03', 'YYYY-MM-DD HH24:MI:SS'), '03', 'CCC', 'C','AAAxdYAAFAAAPJUAAC');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (4, to_date('2010-12-07 00:00:04', 'YYYY-MM-DD HH24:MI:SS'), '04', 'DDDDD', 'D','AAAxdYAAFAAAPJUAAD');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (5, to_date('2010-12-07 00:00:05', 'YYYY-MM-DD HH24:MI:SS'), '05', 'EEEEEE', 'E','AAAxdYAAFAAAPJUAAE');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (6, to_date('2010-12-07 12:50:01', 'YYYY-MM-DD HH24:MI:SS'), '06', 'FFFFFFF', 'F','AAAxdYAAFAAAPJUAAF');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (7.654321, to_date('2010-12-07 12:50:02', 'YYYY-MM-DD HH24:MI:SS')+1, '07', 'FFFFFF1', 'G','AAAxdYAAFAAAPJUAAG');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (8.7654321, to_date('2010-12-07 12:50:03', 'YYYY-MM-DD HH24:MI:SS')+2, '08', 'FFFFFF2', 'H','AAAxdYAAFAAAPJUAAH');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (9.87654321, to_date('2010-12-07 12:50:04', 'YYYY-MM-DD HH24:MI:SS')+3, '09', 'FFFFFF3', 'I','AAAxdYAAFAAAPJUAAI');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (10.987654321, to_date('2010-12-07 12:50:05', 'YYYY-MM-DD HH24:MI:SS'), '0A', 'FFFFFFF', 'J','AAAxdYAAFAAAPJUAAJ');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (2.123456789123123456789123456789123456789E33, to_date('2010-12-07 12:50:01', 'YYYY-MM-DD HH24:MI:SS')+100,'AC1265231212CDAC1265231212CDAC1265231212CDAC1265231212CDAC1265231212CD', lpad('A',35,'C'), lpad('A',35,'C'),'AAAxdYAAFAAAPJUAAK');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (2.123456789123123456789123456789123456790E33, to_date('2010-12-07 12:50:01', 'YYYY-MM-DD HH24:MI:SS')+101,'AC1265231212CDAC1265231212CDAC1265231212CDAC1265231212CDAC1265231212AB', lpad('A',35,'C')||'1', lpad('A',35,'C')||'1','AAAxdYAAFAAAPJUAAL');
- 1 row created.
- HELLODBA.COM>insert into demo.htc3 values (2.123456789123123456789123456789123456789E35, to_date('2010-12-07 12:50:59', 'YYYY-MM-DD HH24:MI:SS'), 'AC1265231212CDAC1265231212CDAC1265231212CDAC1265231212CDAC1265231212EF', lpad('A',35,'C')||'2', lpad('A',35,'C')||'2','AAAxdYAAFAAAPJUAAM');
- 1 row created.
- HELLODBA.COM>commit;
- Commit complete.
- HELLODBA.COM>set serveroutput on
- HELLODBA.COM>begin
- 2 dbms_output.enable(1000000);
- 3 dbms_stats.set_param('TRACE',16383);
- 4 dbms_stats.gather_table_stats('DEMO','HTC3',NULL,0,FALSE,'FOR ALL COLUMNS');
- 5 end;
- 6 /
- ...
Number (NUMBER and the subtypes)
We can acknowledge oracle use the original data to group the bucket for histogram from the traced query.
SQL代码
- select substrb(dump(val, 16, 0, 32), 1, 120) ep, cnt
- from (select /*+ no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring */
- "A" val, count(*) cnt
- from "DEMO"."HTC3" t
- where "A" is not null
- group by "A")
- order by val
To store a number value as endpoint value, oracle will ROUND it to the 15th position start from left end.
SQL代码
- HELLODBA.COM>set numw 50
- HELLODBA.COM>select endpoint_number,
- 2 endpoint_value
- 3 from dba_histograms
- 4 where owner = 'DEMO'
- 5 and table_name = 'HTC3'
- 6 and column_name = 'A';
- ENDPOINT_NUMBER ENDPOINT_VALUE
- ---------------------------------------- ----------------------------------------
- 1 1
- 2 2
- 3 3
- 4 4
- 5 5
- 6 6
- 7 7.654321
- 8 8.7654321
- 9 9.87654321
- 10 10.987654321
- 11 2123456789123120000000000000000000
- 12 2123456789123120000000000000000000
- 13 212345678912312000000000000000000000
- 13 rows selected.
Wo can calculate the endpoint value from actual data value with rounding.
SQL代码
- HELLODBA.COM>select a, round(a,15-length(trunc(a))) from demo.htc3;
- A ROUND(A,15-LENGTH(TRUNC(A)))
- ---------------------------------------- ----------------------------------------
- 1 1
- 2 2
- 3 3
- 4 4
- 5 5
- 6 6
- 7.654321 7.654321
- 8.7654321 8.7654321
- 9.87654321 9.87654321
- 10.987654321 10.987654321
- 2123456789123123456789123456789123.45679 2123456789123120000000000000000000
- 2123456789123123456789123456789123.45679 2123456789123120000000000000000000
- 212345678912312345678912345678912345.679 212345678912312000000000000000000000
- 13 rows selected.
Because the difference of precision between data to create histogram and the endpoint value, there may be multiple buckets with same endpoint value. This will confuse the optimizer to estimate the cost. Look at below case.
SQL代码
- HELLODBA.COM>create table demo.htc5 (a number);
- Table created.
- HELLODBA.COM>insert into demo.htc5 values(123456789.123456789);
- 1 row created.
- HELLODBA.COM>insert into demo.htc5 values(123456789.123456799);
- 1 row created.
- HELLODBA.COM>insert into demo.htc5 values(123456789.123456799);
- 1 row created.
- HELLODBA.COM>insert into demo.htc5 values(123456789.123456799);
- 1 row created.
- HELLODBA.COM>insert into demo.htc5 values(123456789.123456799);
- 1 row created.
- HELLODBA.COM>insert into demo.htc5 values(123456789.123456799);
- 1 row created.
- HELLODBA.COM>insert into demo.htc5 values(123456799.123456799);
- 1 row created.
- HELLODBA.COM>insert into demo.htc5 values(123456799.123456799);
- 1 row created.
- HELLODBA.COM>commit;
- Commit complete.
- HELLODBA.COM>begin
- 2 dbms_output.enable(1000000);
- 3 dbms_stats.set_param('TRACE',16383);
- 4 dbms_stats.gather_table_stats('DEMO','HTC5',NULL,0,FALSE,'FOR ALL COLUMNS');
- 5 end;
- 6 /
- PL/SQL procedure successfully completed.
- HELLODBA.COM>select endpoint_number,
- 2 endpoint_value
- 3 from dba_histograms
- 4 where owner = 'DEMO'
- 5 and table_name = 'HTC5'
- 6 and column_name = 'A';
- ENDPOINT_NUMBER ENDPOINT_VALUE
- ---------------------------------------- ----------------------------------------
- 1 123456789.123457
- 6 123456789.123457
- 8 123456799.123457
The endpoint value of the 1st & 2nd bucket are the same value. Let's explain the query to equal predict these values.
SQL代码
- HELLODBA.COM>set autot trace exp
- HELLODBA.COM>select * from demo.htc5 where a=123456789.123456789;
- Execution Plan
- ----------------------------------------------------------
- Plan hash value: 4195264197
- --------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- --------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 5 | 60 | 3 (0)| 00:00:01 |
- |* 1 | TABLE ACCESS FULL| HTC5 | 5 | 60 | 3 (0)| 00:00:01 |
- --------------------------------------------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 1 - filter("A"=123456789.123456789)
- HELLODBA.COM>select * from demo.htc5 where a=123456789.123456799;
- Execution Plan
- ----------------------------------------------------------
- Plan hash value: 4195264197
- --------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- --------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 5 | 60 | 3 (0)| 00:00:01 |
- |* 1 | TABLE ACCESS FULL| HTC5 | 5 | 60 | 3 (0)| 00:00:01 |
- --------------------------------------------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 1 - filter("A"=123456789.123456799)
- HELLODBA.COM>select * from demo.htc5 where a=123456799.123456799;
- Execution Plan
- ----------------------------------------------------------
- Plan hash value: 4195264197
- --------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- --------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 2 | 24 | 3 (0)| 00:00:01 |
- |* 1 | TABLE ACCESS FULL| HTC5 | 2 | 24 | 3 (0)| 00:00:01 |
- --------------------------------------------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 1 - filter("A"=123456799.123456799)
When estimate the number of rows of the value of the 1st bucket, the optimizer got the number of the 2nd bucket.
Date (DATE, TIMESTAMP and subtypes)
Oracle also uses the original data to create histogram:
SQL代码
- select substrb(dump(val, 16, 0, 32), 1, 120) ep, cnt
- from (select /*+ no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring */
- "B" val, count(*) cnt
- from "DEMO"."HTC3" t
- where "B" is not null
- group by "B")
- order by val
To store the data as endpoint value, it needs convert the date to number. The rule is converting the value to days, both date & time parts. To convert time parts to day, it will convert it to seconds then divide 86400(24*60*60), which is the number of seconds of one day. After that, the number should also be ROUND to the 15th position before be stored.
SQL代码
- HELLODBA.COM>select endpoint_number,
- 2 endpoint_value
- 3 from dba_histograms
- 4 where owner = 'DEMO'
- 5 and table_name = 'HTC3'
- 6 and column_name = 'B';
- ENDPOINT_NUMBER ENDPOINT_VALUE
- ---------------------------------------- ----------------------------------------
- 1 2455538.00001157
- 2 2455538.00002315
- 3 2455538.00003472
- 4 2455538.0000463
- 5 2455538.00005787
- 6 2455538.5347338
- 7 2455538.53478009
- 8 2455538.53540509
- 9 2455539.53474537
- 10 2455540.53475695
- 11 2455541.53476852
- 12 2455638.5347338
- 13 2455639.5347338
- 13 rows selected.
- HELLODBA.COM>alter session set NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS';
- Session altered.
- HELLODBA.COM>select b, round(dn,15-length(trunc(dn))) from (select b, TO_NUMBER(TO_CHAR(b, 'J'))+TO_NUMBER(TO_CHAR(b, 'SSSSS'))/(24*60*60) dn from demo.htc3 order by b);
- B ROUND(DN,15-LENGTH(TRUNC(DN)))
- ------------------- ----------------------------------------
- 2010-12-07 00:00:01 2455538.00001157
- 2010-12-07 00:00:02 2455538.00002315
- 2010-12-07 00:00:03 2455538.00003472
- 2010-12-07 00:00:04 2455538.0000463
- 2010-12-07 00:00:05 2455538.00005787
- 2010-12-07 12:50:01 2455538.5347338
- 2010-12-07 12:50:05 2455538.53478009
- 2010-12-07 12:50:59 2455538.53540509
- 2010-12-08 12:50:02 2455539.53474537
- 2010-12-09 12:50:03 2455540.53475694
- 2010-12-10 12:50:04 2455541.53476852
- 2011-03-17 12:50:01 2455638.5347338
- 2011-03-18 12:50:01 2455639.5347338
- 13 rows selected.
RAW
When grouping RAW data to histogram buckets, if the maximum size of data is larger than 32 bytes, oracle will substrb the left 32 bytes, otherwise will use the original data directly.
SQL代码
- select substrb(dump(val, 16, 0, 32), 1, 120) ep, cnt
- from (select /*+ no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring */
- substrb("C", 1, 32) val, count(*) cnt
- from "DEMO"."HTC3" t
- where substrb("C", 1, 32) is not null
- group by substrb("C", 1, 32))
- order by val
To be stored as endpoint value, the left 30 bytes will be converted to decimal from hex. If it less than 30 bytes, oracle will fill with '0' before converting.
SQL代码
- HELLODBA.COM>select endpoint_number,
- 2 endpoint_value
- 3 from dba_histograms
- 4 where owner = 'DEMO'
- 5 and table_name = 'HTC3'
- 6 and column_name = 'C';
- ENDPOINT_NUMBER ENDPOINT_VALUE
- ---------------------------------------- ----------------------------------------
- 1 5192296858534830000000000000000000
- 2 10384593717069700000000000000000000
- 3 15576890575604500000000000000000000
- 4 20769187434139300000000000000000000
- 5 25961484292674100000000000000000000
- 6 31153781151209000000000000000000000
- 7 36346078009743800000000000000000000
- 8 41538374868278600000000000000000000
- 9 46730671726813500000000000000000000
- 10 51922968585348300000000000000000000
- 13 893448155939095000000000000000000000
- 11 rows selected.
- HELLODBA.COM>select c, round(rn, 15 - length(trunc(rn)))
- 2 from (select c,
- 3 to_number(substrb(c || '' ||
- 4 lpad('0', 30 - length(c || ''), '0'),
- 5 0,
- 6 30),
- 7 lpad('X', 30, 'X')) rn
- 8 from demo.htc3)
- 9 order by rn;
- C ROUND(RN,15-LENGTH(TRUNC(RN)))
- ---------------------------------------------------------------------- ------------------------------------------
- 01 5192296858534830000000000000000000
- 02 10384593717069700000000000000000000
- 03 15576890575604500000000000000000000
- 04 20769187434139300000000000000000000
- 05 25961484292674100000000000000000000
- 06 31153781151209000000000000000000000
- 07 36346078009743800000000000000000000
- 08 41538374868278600000000000000000000
- 09 46730671726813400000000000000000000
- 0A 51922968585348300000000000000000000
- AC1265231212CDAC1265231212CDAC1265231212CDAC1265231212CDAC1265231212CD 893448155939095000000000000000000000
- AC1265231212CDAC1265231212CDAC1265231212CDAC1265231212CDAC1265231212AB 893448155939095000000000000000000000
- AC1265231212CDAC1265231212CDAC1265231212CDAC1265231212CDAC1265231212EF 893448155939095000000000000000000000
- 13 rows selected.
Character Set (CHAR、VARCHAR2、NCHAR、NVARCHAR2)
Just like RAW, if the maximum size larger than 32 bytes, it will substrb to 32 bytes, otherwise, use the original data to group the buckets. One thing needs to be noted is that it's sorted by binary.
SQL代码
- select substrb(dump(val, 16, 0, 32), 1, 120) ep, cnt
- from (select /*+ no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring */
- substrb("D", 1, 32) val, count(*) cnt
- from "DEMO"."HTC3" t
- where substrb("D", 1, 32) is not null
- group by substrb("D", 1, 32))
- order by nlssort(val, 'NLS_SORT = binary')
To be stored as endpoint value, it will be converted to RAW first, then follow the converting/storing rule of RAW.
SQL代码
- HELLODBA.COM>select endpoint_number,
- 2 endpoint_value,
- 3 endpoint_actual_value
- 4 from dba_histograms
- 5 where owner = 'DEMO'
- 6 and table_name = 'HTC3'
- 7 and column_name = 'D';
- ENDPOINT_NUMBER ENDPOINT_VALUE ENDPOINT_ACTUAL_VALUE
- ---------------------------------------- ---------------------------------------- -------------------------------------------------------
- 1 337499295804764000000000000000000000 A
- 2 344030231697140000000000000000000000 BB
- 3 349248119252167000000000000000000000 CCC
- 6 349248140068978000000000000000000000 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
- 7 354460798875655000000000000000000000 DDDDD
- 8 359673457682976000000000000000000000 EEEEEE
- 9 364886116489977000000000000000000000 FFFFFF1
- 10 364886116489977000000000000000000000 FFFFFF2
- 11 364886116489977000000000000000000000 FFFFFF3
- 13 364886116489977000000000000000000000 FFFFFFF
- 10 rows selected.
- HELLODBA.COM>select d, round(cn, 15 - length(trunc(cn)))
- 2 from (select d,
- 3 to_number(substrb(utl_raw.cast_to_raw(d) || '' ||
- 4 lpad('0', 30 - length(utl_raw.cast_to_raw(d) || ''), '0'),
- 5 0,
- 6 30),
- 7 lpad('X', 30, 'X')) cn
- 8 from demo.htc3)
- 9 order by cn;
- D ROUND(CN,15-LENGTH(TRUNC(CN)))
- ------------------------------------------------------------------------------------- ----------------------------------------
- A 337499295804764000000000000000000000
- BB 344030231697140000000000000000000000
- CCC 349248119252167000000000000000000000
- CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCA1 349248140068978000000000000000000000
- CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCA2 349248140068978000000000000000000000
- CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCA 349248140068978000000000000000000000
- DDDDD 354460798875655000000000000000000000
- EEEEEE 359673457682976000000000000000000000
- FFFFFF1 364886116489977000000000000000000000
- FFFFFF2 364886116489977000000000000000000000
- FFFFFF3 364886116489977000000000000000000000
- FFFFFFF 364886116489977000000000000000000000
- FFFFFFF 364886116489977000000000000000000000
- 13 rows selected.
One thing should be payed attention to. After data be ROUND to left 15th position, the precision degraded much. If we convert it back to character, we will found the finally data just be kept at most 6~7 characters (rely on charater set) of original data.
SQL代码
- HELLODBA.COM>select utl_raw.cast_to_varchar2(trim(to_char(ev,lpad('X', 30, 'X'))))
- 2 from
- 3 (select d, round(cn, 15 - length(trunc(cn))) ev
- 4 from (select d,
- 5 to_number(substrb(utl_raw.cast_to_raw(d) || '' ||
- 6 lpad('0', 30 - length(utl_raw.cast_to_raw(d) || ''), '0'),
- 7 0,
- 8 30),
- 9 lpad('X', 30, 'X')) cn
- 10 from demo.htc3)
- 11 order by cn);
- UTL_RAW.CAST_TO_VARCHAR2(TRIM(TO_CHAR(EV,LPAD('X',30,'X'))))
- ---------------------------------------------------------------------------
- A 靠
- BB 靠
- CCC `靠`
- CCCCCCH靠
- CCCCCCH靠
- CCCCCCH靠
- DDDDC靠?`
- EEEEEEA靠
- FFFFFFKZ靠
- FFFFFFKZ靠
- FFFFFFKZ靠
- FFFFFFKZ靠
- FFFFFFKZ靠
- 13 rows selected.
Such precision will increase the possibility of duplicated buckets, means will increase the possibility of optimizer estimating to the wrong result. To reduce such risk, when finally store the histogram, oracle will store the original data into histgrm$.EPVALUE as endpoint actual value if it found duplicated buckets. When optimizer estimating cost, if the prediction value matched the duplicated buckets, it will refer to the endpoint actual value to identity the real bucket.
Note: Just character data may has the endpoint actual value.
ROWID
Oracle also use the original ROWID data to group the histogram buckets. It will also convert it to RAW data and follow the convertiong/storing rules of RAW data to store it as endpoint value. We understand how to convert ROWID to RAW, we need understand its construct first. The 1st~4th bytes are the Data Object Number; the 5th, 6th bytes are the Data File Number in 64 hex; the 7th, 8th bytes are the Data Block Number; the 9th, 10th bytes are the Record Number.
SQL代码
- HELLODBA.COM>select endpoint_number,
- 2 endpoint_value
- 3 from dba_histograms
- 4 where owner = 'DEMO'
- 5 and table_name = 'HTC3'
- 6 and column_name = 'F';
- ENDPOINT_NUMBER ENDPOINT_VALUE
- ---------------------------------------- ----------------------------------------
- 1 62696712745274800000000000000000
- 2 62696712745274800000000000000000
- 3 62696712745274800000000000000000
- 4 62696712745274800000000000000000
- 5 62696712745274800000000000000000
- 6 62696712745274800000000000000000
- 7 62696712745274800000000000000000
- 8 62696712745274800000000000000000
- 9 62696712745274800000000000000000
- 10 62696712745274800000000000000000
- 11 62696712745274800000000000000000
- 12 62696712745274800000000000000000
- 13 62696712745274800000000000000000
- 13 rows selected.
- HELLODBA.COM>select f, round(rn, 15 - length(trunc(rn))) ev
- 2 from (select f,
- 3 to_number(substrb(fs || '' || lpad('0', 10, '0'), 0, 30),
- 4 lpad('X', 30, 'X')) rn
- 5 from (select f,
- 6 lpad(trim(to_char(dbms_rowid.rowid_object(f), 'XXXXXX')), 8, '0') ||
- 7 lpad(trim(to_char(dbms_rowid.rowid_relative_fno(f) * 64, 'XXXX')), 4, '0') ||
- 8 lpad(trim(to_char(dbms_rowid.rowid_block_number(f), 'XXXX')), 4, '0') ||
- 9 lpad(trim(to_char(dbms_rowid.rowid_row_number(f), 'XXXX')), 4, '0') fs
- 10 from demo.htc3))
- 11 order by rn;
- F EV
- ------------------ ----------------------------------------
- AAAxdYAAFAAAPJUAAA 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAB 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAC 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAD 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAE 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAF 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAG 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAH 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAI 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAJ 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAK 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAL 62696712745274800000000000000000
- AAAxdYAAFAAAPJUAAM 62696712745274800000000000000000
- 13 rows selected.
Other Data Types
For BLOB, CLOB, BFILE, CFILE, LONG, LONG RAW columns, oracle will not create histogram.
--- Fuyuncat TBC ---