BW statistics& index
hI,
This is madhavi. can any body explain abt BW statistics& indexes.
in real time how do we use these.. on what based we make decision on these.
Regards,
Madhavi
Hi,
in rsa1->environment->bw statistics for infoprovider
BW Statistics is useful to know the performences like aggregates,quaries and etc..
After the installation you have to also load the Stat cube manually or using process chain once a while upon your business requirements.
Only then you can see the request and the data into the cube.
INDEXES
Re: Index in cube
Posted: Apr 26, 2007 8:32 PM in response to: naga yadavalli Reply
1. What is the use of create index and delete index in the performance tab of cube........
Index ( if properly created) will reduce the query response time. While an object gets activated, the system automatically create primary indexes. Optionaly, you can create additional index called secondary indexes.
2. How does it effect the performance...
As said in 1. if the index is creates for a right reason, it will speed up the query search time. If not, it will pull down the performance.
3. When and why do we sometimes use in process chains? (delete index and create index)
Before loading data, it is advisable to delete the indexes and insert them back after the loading
The main objective of Indexs it will improve the Query Response time.
Indexes act like pointers for quickly geting the Data.When u delete it will delete indexes and when u create it will create the indexes.
When loading we delete Bcs during loading it has to look for existing Indexes and try to update so it will effect the Data load performence so we delete and create it will take less time when compared to updating the existing ones.
There is one more issue we have to take care if u r having more than 50 million records this is not a good practice insteah we can delete and create during week
When loading we delete Bcs during loading it has to look for existing Indexes and try to update so it will effect the Data load performence so we delete and create it will take less time when compared to updating the existing ones
The primary index of a table is always a unique index since the index fields form the key of the table, uniquely identifying each data record.
You can define a secondary index as a unique index when you create it. This ensures that there are no double records in the table fields contained in the index. An attempt to maintain an entry violating this condition in the table results in termination due to a database error
Hareesh
Similar Messages
-
Error in Update optimizer statistics - index is in unusable state
Hello,
we have this error in log Check and update optimizer statistics:
12.02.2009 23:21:20 'BEGIN DBMS_STATS.GATHER_TABLE_STATS (OWNNAME => '"SAPPB1"', TABNAME => '"/BIC/FZPPC0002"', ESTIMATE_PERCENT => 10, METHOD_OPT =
12.02.2009 23:21:20 ORA-20000: index "SAPPB1"."/BIC/FZPPC0002~010" or partition of such index is in unusable state
12.02.2009 23:21:20 ORA-06512: at "SYS.DBMS_STATS", line 13452
12.02.2009 23:21:20 ORA-06512: at "SYS.DBMS_STATS", line 13472
12.02.2009 23:21:20 ORA-06512: at line 1
12.02.2009 23:21:20 BR0886E Checking/collecting statistics failed for table SAPPB1./BIC/FZPPC0002
i can temporary fix this problem when i delete and recreate index via SE14, but this help only for one next running update statistics, every next running update statistics has same error: index "SAPPB1"."/BIC/FZPPC0002~010" or partition of such index is in unusable state. Exist any definitive solution for this problem. ThanksHi,
Two methods for checking/repairing Indexing issues
1)RSRV for a particular cube
2)SAP_INFOCUBE_INDEXES_REPAIR report
You can also use this sql to rebuild an Index.
alter index <index name> rebuild online; Or you can rebuild Index by using ABAP report 'RSANAORA'.
Please check below thread it may help you.
/message/6483705#6483705 [original link is broken]
https://forums.sdn.sap.com/click.jspa?searchID=12942068&messageID=2052264
Thanks,
Sushil -
Table statistics / index statistics generation
Hi,
How often do you run/should system run table & index statistics through DBA calendar/BRtool? What impact on system load does it have? Do you run it for all tables & indecies above certain size?
Thank you,
Mikehi Dear,
How often do you run/should system run table & index statistics through DBA calendar/BRtool*S*?
basically we can run with DB13 and if you want to run through BRTOOLS then following steps:
Run --> brtools
select 7
select 1
press C three time
process will be executing the table.
press c // now i m applying
What impact on system load does it have?
it maintain the update and good for health of database...// like.. you don't stable yourseft with out exercise mean it is exercise of datebase
Do you run it for all tables & indecies above certain size?
yea
don't forget the point
regards,
majamil -
Object statistics - indexed not used (GATHER_STATS_JOB)
hi all,
I have few top SQL statements in my DB...which is very basic to me
select ... from tab where user_id = 'xxx';
User_id is indexed..
Therefore, i run the few top SQL statement myself, and realize it is doing FTS.. even for result set of 1 row only.
Therefore i do a simple DBMS_STATS
and it started using the index on user_id.
The optimizer cost drop from a 1000 to simple 13 to 14.
My question is
1st) i have value 10 for job_queue_processes
2nd) i have GATHER_STATS_JOB scheduled and running successfully.
q1) why do i have to do DBMS_STATS manually before it started to use the index again.
This FTS has been on-going for about 2 weeks.
Regards,
NoobGATHER_STATS_JOB, if using default configuration, runs every night from 10 P.M. to 6 A.M. and all day on weekends, gather statistics on objects
that have no previously gathered statistics, or if the existing statistic are staled, and by default configuration stale statistics are when more than 10% of the table's rows are changed.
Table which you are mentioning seems to have less then 10% of the whole table rows changed, meaning condition/s for stats gathering with default configuration
are not met, and therefore stats are not gathered.
You can run select * from dba_scheduler_jobs where job_name='GATHER_STATS_JOB' to find additional details about the job.
Official documentation can be good starting point to provide further explanations. -
Hi
I have a query:
I have a table having date and status as fields. Date is indexed.
Now i want to know whether the performance will hit if i make the query as:
where status = 'A' and date >= sysdate-100 and date <= sysdate
Does it matter that the where clause ordering should be as per ordering of indexes?
Similarly the same thing for partition. If date field is partitioned, will the partitioning advantage is there if we put status condition first.
RegardsThe optimizer will choose the order of operations that it believes will cause your query to run the most quickly regardless of the order you specify conditions in your WHERE clause. The optimizer's decision will be driven by a number of factors-- optimizer parameters, database version, system statistics, table statistics, index statistics, histograms, the selectivity of your conditions, etc. No one can say with any level of certainty what the optimizer in your particular database with your particular tables and indexes with your particular statistics would generate for a query plan.
If you as a human have reason to believe that the date condition is sufficiently selective that the optimizer should use that to do an index range scan as the first step, the optimizer should come up with that plan assuming your statistics back up your intuition.
Justin -
Hi All.
I am executing a SQL on a table, I have three different indexes on three different column let say, table have a, b, c, d, e, f, g, h, i , j.
Index created on c, d, g
Column "C" and "D" have values in every row, while "G" dont have value in any row.
Index not executed when I wrote following where clause:
Case 1
Where C is not null
Case 2
Where D is not null
While index executed when I wrote where clause as
where "G" is not null;
Whats wrong with it?
HassanIn some cases Oracle can also choose Fast Full Scan in case "C" and "D". Please look at the example below:
[email protected]> select index_name from user_indexes where table_name = 'PRODUCTS'
2 /
no rows selected
[email protected]> create index products_name_idx on products(prod_name) compute statistics;
Index created.
[email protected]> set autotrace traceonly explain statistics
[email protected]> select prod_name from products where prod_name is not null;
10000 rows selected.
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=14 Card=10000 Bytes=
250000)
1 0 INDEX (FAST FULL SCAN) OF 'PRODUCTS_NAME_IDX' (NON-UNIQUE)
(Cost=14 Card=10000 Bytes=250000)
Statistics
117 recursive calls
0 db block gets
775 consistent gets
51 physical reads
0 redo size
150267 bytes sent via SQL*Net to client
7825 bytes received via SQL*Net from client
668 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
10000 rows processed
Here there is no need to read table data because Oracle can satisfy this query using just data that is in the index blocks
Best Regards
Krystian Zieja / mob -
BW Statistics for BW Accelerator
Hi Everyone,
Is there any standard business content to collect the statistics information for BW accelerator?
If not, can you please suggest how to collect the BWA statistics?
Thanks
Kind Regards
AnukulANUKUL GIRADKAR wrote:
Hi Everyone,
>
> Is there any standard business content to collect the statistics information for BW accelerator?
>
> If not, can you please suggest how to collect the BWA statistics?
>
> Thanks
>
> --
> Kind Regards
> Anukul
Oss Note "1163732 - BWA 7.00: BWA statistics index" explains it -
Error while impdp: ORA-02374: conversion error loading table
Hi,
I am trying to convert the character set from WE8ISO8859P1 to AL32UTF8 using expdp/impdp. for this I first convert WE8ISO8859P1 to WE8MSWIN1252 in source DB to get rid of “lossy” data. I created new database(target) with character set AL32UTF8 and nls_length_semantics = ’CHAR’ and created all the tablespaces as in source DB with auoexend on. I took full export (expdp) of source DB excluding TABLESPACE,STATISTICS,INDEX,CONSTRAINT,REF_CONSTRAINT and imported using impdp to target DB. I found below error in the import log file:
ORA-02374: conversion error loading table "SCTCVT"."SPRADDR_CVT"
ORA-26093: input data column size (44) exceeds the maximum input size (40)
ORA-02372: data for row: CONVERT_STREET_LINE1 : 0X'20202020202020202020202020202020202020202020202020'
I checked with select query on both DBs with below results.
source DB:
04:58:42 SQL> select count(*) from "SCTCVT"."SPRADDR_CVT";
COUNT(*)
74553
target DB:
04:59:24 SQL> select count(*) from "SCTCVT"."SPRADDR_CVT";
COUNT(*)
74552
please suggest me a solution to this.
Thanks and Regards.
Edited by: user12045167 on May 9, 2011 10:39 PMThanks for your update maher.
09:15:53 SQL> desc "SCTCVT"."SPRADDR_CVT"
Name Null? Type
SPRADDR_PIDM NUMBER(8)
CONVERT_PIDM VARCHAR2(9 CHAR)
SPRADDR_ATYP_CODE VARCHAR2(2 CHAR)
CONVERT_ATYP_CODE VARCHAR2(2 CHAR)
SPRADDR_SEQNO NUMBER(2)
CONVERT_SEQNO VARCHAR2(2 CHAR)
SPRADDR_FROM_DATE DATE
CONVERT_FROM_DATE VARCHAR2(8 CHAR)
SPRADDR_TO_DATE DATE
CONVERT_TO_DATE VARCHAR2(8 CHAR)
SPRADDR_STREET_LINE1 VARCHAR2(30 CHAR)
CONVERT_STREET_LINE1 VARCHAR2(40 CHAR)
SPRADDR_STREET_LINE2 VARCHAR2(30 CHAR)
CONVERT_STREET_LINE2 VARCHAR2(40 CHAR)
SPRADDR_STREET_LINE3 VARCHAR2(30 CHAR)
CONVERT_STREET_LINE3 VARCHAR2(40 CHAR)
SPRADDR_CITY VARCHAR2(20 CHAR)
CONVERT_CITY VARCHAR2(25 CHAR)
SPRADDR_STAT_CODE VARCHAR2(3 CHAR)
CONVERT_STAT_CODE VARCHAR2(25 CHAR)
SPRADDR_ZIP VARCHAR2(10 CHAR)
CONVERT_ZIP VARCHAR2(15 CHAR)
SPRADDR_CNTY_CODE VARCHAR2(5 CHAR)
CONVERT_CNTY_CODE VARCHAR2(5 CHAR)
SPRADDR_NATN_CODE VARCHAR2(5 CHAR)
CONVERT_NATN_CODE VARCHAR2(5 CHAR)
SPRADDR_PHONE_AREA VARCHAR2(3 CHAR)
CONVERT_PHONE_AREA VARCHAR2(3 CHAR)
SPRADDR_PHONE_NUMBER VARCHAR2(7 CHAR)
CONVERT_PHONE_NUMBER VARCHAR2(7 CHAR)
SPRADDR_PHONE_EXT VARCHAR2(4 CHAR)
CONVERT_PHONE_EXT VARCHAR2(4 CHAR)
SPRADDR_STATUS_IND VARCHAR2(1 CHAR)
CONVERT_STATUS_IND VARCHAR2(1 CHAR)
SPRADDR_ACTIVITY_DATE DATE
CONVERT_ACTIVITY_DATE VARCHAR2(8 CHAR)
SPRADDR_USER VARCHAR2(30 CHAR)
CONVERT_USER VARCHAR2(30 CHAR)
SPRADDR_ASRC_CODE VARCHAR2(4 CHAR)
CONVERT_ASRC_CODE VARCHAR2(4 CHAR)
SPRADDR_DELIVERY_POINT NUMBER(2)
CONVERT_DELIVERY_POINT VARCHAR2(2 CHAR)
SPRADDR_CORRECTION_DIGIT NUMBER(1)
CONVERT_CORRECTION_DIGIT VARCHAR2(1 CHAR)
SPRADDR_CARRIER_ROUTE VARCHAR2(4 CHAR)
CONVERT_CARRIER_ROUTE VARCHAR2(4 CHAR)
SPRADDR_GST_TAX_ID VARCHAR2(15 CHAR)
CONVERT_GST_TAX_ID VARCHAR2(15 CHAR)
SPRADDR_REVIEWED_IND VARCHAR2(1 CHAR)
CONVERT_REVIEWED_IND VARCHAR2(1 CHAR)
SPRADDR_REVIEWED_USER VARCHAR2(30 CHAR)
CONVERT_REVIEWED_USER VARCHAR2(30 CHAR)
SPRADDR_DATA_ORIGIN VARCHAR2(30 CHAR)
CONVERT_DATA_ORIGIN VARCHAR2(30 CHAR)
SPRADDR_CVT_RECORD_ID NUMBER(8)
SPRADDR_CVT_STATUS VARCHAR2(1 CHAR)
SPRADDR_CVT_JOB_ID NUMBER(8)
so here we can see its value is 40 (CONVERT_STREET_LINE1 VARCHAR2(40 CHAR)).
shall i go ahead altering the column? -
Column_name in user_ind_columns when descending??
When I create an indexe with a descending column, the value in user_ind_columns.column_name is not the actual column_name, it's something like SYS_NC00002$. I'm trying to build a Select statement to identify the columns in an index, whether ascending or descending. Everything is fine if ascending, but if descending I cannot figure out how to identify the actual column_name. What table should I be joining to?
Interesting. I notice from analyzing descending index that it appears to include NULL rows - I am not sure why, since B*Tree and FBI do not. Not sure whether that explains the difference times Laurent is getting for his range scan.
Can't think of a reason to use a descending index on a single column. Tom Kyte points out (in his book, available on Amazon etc. blah blah) that multi-column descending/ascending indexes can be used to sort queries with different sort orders on different columns (providing they match those of the index presumably).
Anyway, back to NULLs...
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> SELECT DECODE (GROUPING (comm), 1, 'Total:', comm) comm, COUNT (*)
2 FROM emp
3 GROUP BY ROLLUP (comm);
COMM COUNT(*)
0 1
300 1
500 1
1400 1
10
Total: 14
6 rows selected.
SQL> -- create normal B*Tree
SQL> CREATE INDEX index_name ON emp (comm);
Index created.
SQL> ANALYZE INDEX index_name COMPUTE STATISTICS;
Index analyzed.
SQL> SELECT index_name, index_type, num_rows
2 FROM user_indexes
3 WHERE index_name = 'INDEX_NAME';
INDEX_NAME INDEX_TYPE NUM_ROWS
INDEX_NAME NORMAL 4
SQL> DROP INDEX index_name;
Index dropped.
SQL> -- create descending FBI
SQL> CREATE INDEX index_name ON emp (comm DESC);
Index created.
SQL> ANALYZE INDEX index_name COMPUTE STATISTICS;
Index analyzed.
SQL> SELECT index_name, index_type, num_rows
2 FROM user_indexes
3 WHERE index_name = 'INDEX_NAME';
INDEX_NAME INDEX_TYPE NUM_ROWS
INDEX_NAME FUNCTION-BASED NORMAL 14 <---
SQL> DROP INDEX index_name;
Index dropped.
SQL> -- create normal FBI
SQL> CREATE INDEX index_name ON emp (comm + 0);
Index created.
SQL> ANALYZE INDEX index_name COMPUTE STATISTICS;
Index analyzed.
SQL> SELECT index_name, index_type, num_rows
2 FROM user_indexes
3 WHERE index_name = 'INDEX_NAME';
INDEX_NAME INDEX_TYPE NUM_ROWS
INDEX_NAME FUNCTION-BASED NORMAL 4
SQL> -
SQL Update statement taking too long..
Hi All,
I have a simple update statement that goes through a table of 95000 rows that is taking too long to update; here are the details:
Oracle Version: 11.2.0.1 64bit
OS: Windows 2008 64bit
desc temp_person;
Name Null? Type
PERSON_ID NOT NULL NUMBER(10)
DISTRICT_ID NOT NULL NUMBER(10)
FIRST_NAME VARCHAR2(60)
MIDDLE_NAME VARCHAR2(60)
LAST_NAME VARCHAR2(60)
BIRTH_DATE DATE
SIN VARCHAR2(11)
PARTY_ID NUMBER(10)
ACTIVE_STATUS NOT NULL VARCHAR2(1)
TAXABLE_FLAG VARCHAR2(1)
CPP_EXEMPT VARCHAR2(1)
EVENT_ID NOT NULL NUMBER(10)
USER_INFO_ID NUMBER(10)
TIMESTAMP NOT NULL DATE
CREATE INDEX tmp_rs_PERSON_ED ON temp_person (PERSON_ID,DISTRICT_ID) TABLESPACE D_INDEX;
Index created.
ANALYZE INDEX tmp_PERSON_ED COMPUTE STATISTICS;
Index analyzed.
explain plan for update temp_person
2 set first_name = (select trim(f_name)
3 from ext_names_csv
4 where temp_person.PERSON_ID=ext_names_csv.p_id
5 and temp_person.DISTRICT_ID=ext_names_csv.ed_id);
Explained.
@?/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
Plan hash value: 3786226716
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | 82095 | 4649K| 2052K (4)| 06:50:31 |
| 1 | UPDATE | TEMP_PERSON | | | | |
| 2 | TABLE ACCESS FULL | TEMP_PERSON | 82095 | 4649K| 191 (1)| 00:00:03 |
|* 3 | EXTERNAL TABLE ACCESS FULL| EXT_NAMES_CSV | 1 | 178 | 24 (0)| 00:00:01 |
Predicate Information (identified by operation id):
3 - filter("EXT_NAMES_CSV"."P_ID"=:B1 AND "EXT_NAMES_CSV"."ED_ID"=:B2)
Note
- dynamic sampling used for this statement (level=2)
19 rows selected.By the looks of it the update is going to take 6 hrs!!!
ext_names_csv is an external table that have the same number of rows as the PERSON table.
ROHO@rohof> desc ext_names_csv
Name Null? Type
P_ID NUMBER
ED_ID NUMBER
F_NAME VARCHAR2(300)
L_NAME VARCHAR2(300)Anyone can help diagnose this please.
Thanks
Edited by: rsar001 on Feb 11, 2011 9:10 PMThank you all for the great ideas, you have been extremely helpful. Here is what we did and were able to resolve the query.
We started with Etbin's idea to create a table from the ext table so that we can index and reference easier than an external table, so we did the following:
SQL> create table ext_person as select P_ID,ED_ID,trim(F_NAME) fst_name,trim(L_NAME) lst_name from EXT_NAMES_CSV;
Table created.
SQL> desc ext_person
Name Null? Type
P_ID NUMBER
ED_ID NUMBER
FST_NAME VARCHAR2(300)
LST_NAME VARCHAR2(300)
SQL> select count(*) from ext_person;
COUNT(*)
93383
SQL> CREATE INDEX EXT_PERSON_ED ON ext_person (P_ID,ED_ID) TABLESPACE D_INDEX;
Index created.
SQL> exec dbms_stats.gather_index_stats(ownname=>'APPD', indname=>'EXT_PERSON_ED',partname=> NULL , estimate_percent=> 30 );
PL/SQL procedure successfully completed.We had a look at the plan with the original SQL query that we had:
SQL> explain plan for update temp_person
2 set first_name = (select fst_name
3 from ext_person
4 where temp_person.PERSON_ID=ext_person.p_id
5 and temp_person.DISTRICT_ID=ext_person.ed_id);
Explained.
SQL> @?/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
Plan hash value: 1236196514
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | 93383 | 1550K| 186K (50)| 00:37:24 |
| 1 | UPDATE | TEMP_PERSON | | | | |
| 2 | TABLE ACCESS FULL | TEMP_PERSON | 93383 | 1550K| 191 (1)| 00:00:03 |
| 3 | TABLE ACCESS BY INDEX ROWID| EXTT_PERSON | 9 | 1602 | 1 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | EXT_PERSON_ED | 1 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("EXT_PERSON"."P_ID"=:B1 AND "RS_PERSON"."ED_ID"=:B2)
Note
- dynamic sampling used for this statement (level=2)
20 rows selected.As you can see the time has dropped to 37min (from 6 hrs). Then we decided to change the SQL query and use donisback's suggestion (using MERGE); we explained the plan for teh new query and here is the results:
SQL> explain plan for MERGE INTO temp_person t
2 USING (SELECT fst_name ,p_id,ed_id
3 FROM ext_person) ext
4 ON (ext.p_id=t.person_id AND ext.ed_id=t.district_id)
5 WHEN MATCHED THEN
6 UPDATE set t.first_name=ext.fst_name;
Explained.
SQL> @?/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
Plan hash value: 2192307910
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | MERGE STATEMENT | | 92307 | 14M| | 1417 (1)| 00:00:17 |
| 1 | MERGE | TEMP_PERSON | | | | | |
| 2 | VIEW | | | | | | |
|* 3 | HASH JOIN | | 92307 | 20M| 6384K| 1417 (1)| 00:00:17 |
| 4 | TABLE ACCESS FULL| TEMP_PERSON | 93383 | 5289K| | 192 (2)| 00:00:03 |
| 5 | TABLE ACCESS FULL| EXT_PERSON | 92307 | 15M| | 85 (2)| 00:00:02 |
Predicate Information (identified by operation id):
3 - access("P_ID"="T"."PERSON_ID" AND "ED_ID"="T"."DISTRICT_ID")
Note
- dynamic sampling used for this statement (level=2)
21 rows selected.As you can see, the update now takes 00:00:17 to run (need to say more?) :)
Thank you all for your ideas that helped us get to the solution.
Much appreciated.
Thanks -
Unserstanding user_indexez num_rows & sample_size
Hi ,
I gather some statistics from the user_indexes
but what do num_rows & sample_size means to me ?
basically i know it was last analyzed from the "last_analyzed" column but is the 1)sample_size being used to do the analyze or 2) the num_rows are being used
or 3) it depends on the options being used something like
Analyze table tbl1 Compute statistics --> this mean all rows are used
Analyze table tbl1 Estimate 10 percent --> this mean 10% of the num_rows are being used to analyzed ?
appreciate ur advise
tks & rdgsNUM_ROWS - Number of rows in the index
SAMPLE_SIZE - Size of the sample used to nalyze the index.
[email protected]> create table t1 as select * from all_objects;
Table created.
[email protected]> create index t1_object_name_idx on t1(object_name);
Index created.
[email protected]> analyze index t1_object_name_idx compute statistics;
Index analyzed.
[email protected]> select index_name, sample_size, num_rows
2 from user_indexes
3 where index_name = 'T1_OBJECT_NAME_IDX'
4 /
INDEX_NAME SAMPLE_SIZE NUM_ROWS
T1_OBJECT_NAME_IDX 32511 32511
Above all rows in index were used to gather statistics on an index.
[email protected]> analyze index t1_object_name_idx estimate statistics sample 10 percent;
Index analyzed.
[email protected]> select index_name, sample_size, num_rows
2 from user_indexes
3 where index_name = 'T1_OBJECT_NAME_IDX'
4 /
INDEX_NAME SAMPLE_SIZE NUM_ROWS
T1_OBJECT_NAME_IDX 3151 30919.1875
In this example only 3151 rows were used to gahter index statistics and based on
this sample_size Oracle estimated that there ate 30919 rows in the index.
You should rember that Oracle recomends using DBMS_STATS package to gathere statistics
on database objects. So it should look like this.
[email protected]> exec dbms_stats.gather_index_stats(user,'T1_OBJECT_NAME_IDX',estimate_percent=>10)
PL/SQL procedure successfully completed.
Or better let Oracle choose approperiate sample size:
[email protected]> exec dbms_stats.gather_index_stats(user,'T1_OBJECT_NAME_IDX', -
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE)PL/SQL procedure successfully completed.
Best Regards
Krystian Zieja / mob -
To_timestamp -vs- to_date and full table scans
Is it expected behavior for the to_timstamp function to negate the use of an index where the to_date does not?
Example:
The query:
SELECT hugea.intkey, hugea.stringkey, hugea.intnum, hugea.stringnum,
hugea.floatnum, hugea.longnum, hugea.doublenum, hugea.bytenum,
hugea.datevalue, hugea.timevalue, hugea.timestampvalue,
hugea.booleanvalue, hugea.charvalue, hugea.shortvalue,
hugea.bigintegervalue, hugea.bigdecimalvalue, hugea.objectvalue
FROM hugea
WHERE hugea.timestampvalue = {ts'2000-01-01 03:21:37[u].0'}
Submitted thru a java application generates the following trace IN ORACLE
=====================
PARSING IN CURSOR #4 len=452 dep=0 uid=65 oct=3 lid=65 tim=18446744071203520496 hv=3183903894 ad='6582cbe4'
SELECT hugea.intkey, hugea.stringkey, hugea.intnum, hugea.stringnum,
hugea.floatnum, hugea.longnum, hugea.doublenum, hugea.bytenum,
hugea.datevalue, hugea.timevalue, hugea.timestampvalue,
hugea.booleanvalue, hugea.charvalue, hugea.shortvalue,
hugea.bigintegervalue, hugea.bigdecimalvalue, hugea.objectvalue
FROM hugea
WHERE hugea.timestampvalue = to_timestamp('2000-01-01 03:21:37.0','YYYY-MM-DD HH24:MI:SS.FF')
END OF STMT
PARSE #4:c=359375,e=355026,p=0,cr=63,cu=3,mis=1,r=0,dep=0,og=4,tim=18446744071203520489
EXEC #4:c=0,e=1253028,p=0,cr=3,cu=0,mis=0,r=0,dep=0,og=4,tim=18446744071204773686
FETCH #4:c=0,e=2055128,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=4,tim=18446744071206831146
STAT #4 id=1 cnt=0 pid=0 pos=1 obj=30620 op='TABLE ACCESS FULL HUGEA '*** 2004-07-30 16:06:28.000
=====================
The query:
SELECT hugea.intkey, hugea.stringkey, hugea.intnum, hugea.stringnum,
hugea.floatnum, hugea.longnum, hugea.doublenum, hugea.bytenum,
hugea.datevalue, hugea.timevalue, hugea.timestampvalue,
hugea.booleanvalue, hugea.charvalue, hugea.shortvalue,
hugea.bigintegervalue, hugea.bigdecimalvalue, hugea.objectvalue
FROM hugea
WHERE hugea.timestampvalue = {ts'2000-01-01 03:21:[u]37'}
Submitted thru a java application generates the following trace IN ORACLE
PARSING IN CURSOR #4 len=442 dep=0 uid=65 oct=3 lid=65 tim=18446744071260555440 hv=2315259180 ad='65343e30'
SELECT hugea.intkey, hugea.stringkey, hugea.intnum, hugea.stringnum,
hugea.floatnum, hugea.longnum, hugea.doublenum, hugea.bytenum,
hugea.datevalue, hugea.timevalue, hugea.timestampvalue,
hugea.booleanvalue, hugea.charvalue, hugea.shortvalue,
hugea.bigintegervalue, hugea.bigdecimalvalue, hugea.objectvalue
FROM hugea
WHERE hugea.timestampvalue = to_date('2000-01-01 03:21:37','YYYY-MM-DD HH24:MI:SS')
END OF STMT
PARSE #4:c=0,e=1058,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=4,tim=18446744071260555431
EXEC #4:c=0,e=41,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=18446744071260555686
FETCH #4:c=0,e=58,p=0,cr=4,cu=0,mis=0,r=1,dep=0,og=4,tim=18446744071260557318
STAT #4 id=1 cnt=1 pid=0 pos=1 obj=30620 op='TABLE ACCESS BY INDEX ROWID HUGEA '
STAT #4 id=2 cnt=1 pid=1 pos=1 obj=31428 op='INDEX RANGE SCAN TIMESTAMPVALUE_IX '
Though the problem is related to JAVA/JDBC in this case. The underlying problem (to_date -vs- to_timestamp not acting the same insofar as INDEX utilization) is reproducible within SQL*Plus.
I also tried a function-based index and forced use with hints but had no success.
I'm hoping there is a patch of some kind and that this is simply due to the immaturity of the timestamp datatype.
please advise.your test is then not relevant. if your table is to small, your statistics too old, your range too big, then oracle will not use an index.
SQL> insert into test_timestamp select timestamp '2000-01-01 00:00:00.00' + numtodsinterval(dbms_random.value,'DAY') from all_objects;
SQL> insert into test_timestamp select timestamp '2000-01-01 00:00:00.00' + numtodsinterval(dbms_random.value,'DAY') from all_objects;
SQL> select count(*) from test_timestamp;
COUNT(*)
74706
SQL> analyze table test_timestamp compute statistics;
Table analyzed.
SQL> create index test_timestamp_ix on test_timestamp(ts) compute statistics;
Index created.
SQL> set autot trace exp
SQL> select * from test_timestamp where ts between to_timestamp('2000-01-01','YYYY-MM-DD') and to_timestamp('2000-01-01 00:00:05.00','YYYY-MM-DD HH24:MI:SS.FF');
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=187 Bytes=2
057)
1 0 FILTER
2 1 INDEX (RANGE SCAN) OF 'TEST_TIMESTAMP_IX' (INDEX) (Cost=
2 Card=187 Bytes=2057) -
Does auto statistic slow down inserts?
I found some code on the web to loop through my table's columns dropping indexes so I could do fast inserts overnight. The table has five million records.
The loop threw an error on one of the indexes:
"Cannot drop the index 'ACCOUNTS._WA_Sys_0000000F_31EC6D26', because it does not exist or you do not have permission."
which I gather is an auto-statistics index. Do I need to find a way to drop this index? Currently my INSERTs are still not terribly fast (even though all the indexes showing in the Indexes window have been dropped).The hypothetical column has zero per this query
select * from sys.indexes AS i
left JOIN sys.index_columns AS ic on ic.object_id = i.object_id
where i.object_id = object_id('Accounts')
object_id
name
index_id
type
type_desc
is_unique
data_space_id
ignore_dup_key
is_primary_key
is_unique_constraint
fill_factor
is_padded
is_disabled
is_hypothetical
allow_row_locks
allow_page_locks
has_filter
filter_definition
object_id
index_id
index_column_id
column_id
key_ordinal
partition_ordinal
is_descending_key
is_included_column
837578022
NULL
0
0
HEAP
0
1
0
0
0
0
0
0
0
1
1
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
The id 837578022 is the same ID showing in the original query so I'm pretty sure it's the same index at issue.
As long as it's not having a significant impact on my INSERTs, I have no quarrel with it. I guess I'll just presume the best, for now. -
Hi All
We have a huge table of around 150GB for which 20 indexes are available.
10 out of 20 indexes are showing BLEVEL=3 in dba_indexes.
We are rebuilding these indexes every 3 days in a week to keep performance at peak.
However, blevel is not changed to 2 or maybe 1.
Just want to understand if it is fine to have blevel=3 or there is some catch in it.
Too much of DML is happening on table due to which this is giving poor performance, so we rebuild and analyze table every 2 days in a week.
Please note, partitoning is not possible on table due to vendor application constraints. we can not change any table structure or other things.
Oracle 10G 10.2.0.4 Enterprise Edition with RAC and partitoning enabled.
SUN Solaris 5.10
Thanks
apsaps wrote:
Hi All
We have a huge table of around 150GB for which 20 indexes are available.
10 out of 20 indexes are showing BLEVEL=3 in dba_indexes.
We are rebuilding these indexes every 3 days in a week to keep performance at peak.
However, blevel is not changed to 2 or maybe 1.
Just want to understand if it is fine to have blevel=3 or there is some catch in it.The SIZE of the table is not the relevant indicator - it's the number of rows and the length of the keys that matter. 150GB might be a relatively small number of very long rows, or a relatively large number of very small rows.
Just to give you some idea of the "suitability" of your blevel, I'd suggest you read this note that I wrote a few years ago: http://jonathanlewis.wordpress.com/2007/03/18/thinking-big/
Too much of DML is happening on table due to which this is giving poor performance, so we rebuild and analyze table every 2 days in a week.
Please note, partitoning is not possible on table due to vendor application constraints. we can not change any table structure or other things.
Rebuilding may be making the performance worse - especially every two days. Keep an eye on the Instance Activity Statistics "index leaf block splits" - as your rebuild may be causing lots of them to happen in the day or so immediatly after the rebuild, and making the index grow unnecessarily.
I've also written some code that estimates a "reasonable" size of an index from recent stats and the index definitions. http://jonathanlewis.wordpress.com/2009/12/18/simple-scripts/
Before rebuilding you might like to run the code to see which indexes look as if the need rebuilding, and which indexes don't. There are special cases where you get benefit from rebuilding an index, but it's extremenly unlikely that all 20 of these indexes are special cases.
It's also worth checking for opportunites for index compression. Applications like Siebel often create many similar indexes with several very repetitive leading columns. You may be able to identify some of your indexes as being good targets for compression on some of the leading columns. This may save space and reduce the random I/O that takes place as your application inserts and deletes index entries.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
Author: <b><em>Oracle Core</em></b> -
Hi Gurus,
can you please suggest me what is right way?
1. to join three tables in one SELECT
or
2. to have three SELECT's
In reality first query return ID for second query and this will return also another ID for "real" third query.All good points - however just to nitpick your IN vs EXISTS example, the optimizer will generally transform both queries into a semijoin using an index, if that will result in a lower cost:
SQL> @ind dept
Distinct
Index Unique? Type Status Rows keys Column name
PK_DEPT Y NORMAL VALID 4 4 DEPTNO
SQL> @ind emp
Distinct
Index Unique? Type Status Rows keys Column name
PK_EMP Y NORMAL VALID 14 14 EMPNO
SQL> SELECT dname, deptno
2 FROM dept d
3 WHERE d.deptno IN (SELECT e.deptno FROM emp e)
4
SQL> @xplan
Plan hash value: 1090737117
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 3 | 48 | 6 (17)| 00:00:01 |
| 1 | MERGE JOIN SEMI | | 3 | 48 | 6 (17)| 00:00:01 |
| 2 | TABLE ACCESS BY INDEX ROWID| DEPT | 4 | 52 | 2 (0)| 00:00:01 |
| 3 | INDEX FULL SCAN | PK_DEPT | 4 | | 1 (0)| 00:00:01 |
|* 4 | SORT UNIQUE | | 14 | 42 | 4 (25)| 00:00:01 |
| 5 | TABLE ACCESS FULL | EMP | 14 | 42 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("D"."DEPTNO"="E"."DEPTNO")
filter("D"."DEPTNO"="E"."DEPTNO")
SQL> SELECT dname, deptno
2 FROM dept d
3 WHERE EXISTS
4 ( SELECT e.deptno FROM emp e
5 WHERE d.deptno = e.deptno)
6
SQL> @xplan
Plan hash value: 1090737117
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 3 | 48 | 6 (17)| 00:00:01 |
| 1 | MERGE JOIN SEMI | | 3 | 48 | 6 (17)| 00:00:01 |
| 2 | TABLE ACCESS BY INDEX ROWID| DEPT | 4 | 52 | 2 (0)| 00:00:01 |
| 3 | INDEX FULL SCAN | PK_DEPT | 4 | | 1 (0)| 00:00:01 |
|* 4 | SORT UNIQUE | | 14 | 42 | 4 (25)| 00:00:01 |
| 5 | TABLE ACCESS FULL | EMP | 14 | 42 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("E"."DEPTNO"="D"."DEPTNO")
filter("E"."DEPTNO"="D"."DEPTNO")
SQL> create index emp_deptno_ix on emp(deptno) compute statistics;
Index created.
SQL> SELECT dname, deptno
2 FROM dept d
3 WHERE d.deptno IN (SELECT e.deptno FROM emp e)
4
SQL> @xplan
Plan hash value: 151962099
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 3 | 48 | 3 (0)| 00:00:01 |
| 1 | NESTED LOOPS SEMI | | 3 | 48 | 3 (0)| 00:00:01 |
| 2 | TABLE ACCESS FULL| DEPT | 4 | 52 | 3 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | EMP_DEPTNO_IX | 9 | 27 | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
3 - access("D"."DEPTNO"="E"."DEPTNO")I just mentioned this because "EXISTS is faster than IN" is often repeated around the forums when it is not necessarily true. Of course, I totally agree with the general point, that an SQL query can be written in many different ways and some are far less efficient than others (and cannot be automatically transformed into efficient ones by the optimizer).
Maybe you are looking for
-
Quick Time Player Confusion!
I am confused. In SL, every time I right click a movie file, whatever the format, and select "open with" I get a drop down menu headed: Quick Time Player Launcher (default). What is this? Below this are listed the other players I have installed (VLC,
-
I have written a Java cross platform program that counts the frequency of words in a given text. I output a list with the words and their frequency to a JTextArea as well as to a text file. The program works fine but I still have a problem. My text i
-
How can i get where the mouse pointer is inside a jframe opened up in full screen mode. I want to be able to tell exactly where the mouse pointer is, from any component i have inside the screen. For example when calling the rendering. Some components
-
Exception while using RSA BSAFE CryptoJ in Weblogic 7.0 (SP2)
I need to verify the digital signature in the application (Web Tier - Servlet) and i have got the RSA - BSafe license and tried using the RSA API and this works fine in the stand alone environment. (weblogic.jar is not part of the classpath). I have
-
HI, I started a project on CS4 but i had to uninstal it as my trial expired. I can't import it in CS3, it says the file is not supported or there are obsolete elements. Can anybody suggest a way for me to do it? thanks