100% found this document useful (1 vote)
20 views10 pages

PDF Translator 1693652510100

The document discusses database tuning and indexes. It provides the following key points: - Database performance can be improved up to 70% through hardware upgrades, and the remaining 30% through database management skills like indexing and query optimization. - Indexes are the fastest way to find and access data in a database. They are automatically created for primary and unique keys, and are recommended for foreign keys. - Regular database analysis is important for the cost-based optimizer to have accurate statistics. Analysis should be done daily for heavily used databases. - Both too few and too many indexes can negatively impact performance - indexes improve queries but slow down data modifications due to update overhead. The optimal number of indexes per table is

Uploaded by

kruemeL1969
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
20 views10 pages

PDF Translator 1693652510100

The document discusses database tuning and indexes. It provides the following key points: - Database performance can be improved up to 70% through hardware upgrades, and the remaining 30% through database management skills like indexing and query optimization. - Indexes are the fastest way to find and access data in a database. They are automatically created for primary and unique keys, and are recommended for foreign keys. - Regular database analysis is important for the cost-based optimizer to have accurate statistics. Analysis should be done daily for heavily used databases. - Both too few and too many indexes can negatively impact performance - indexes improve queries but slow down data modifications due to update overhead. The optimal number of indexes per table is

Uploaded by

kruemeL1969
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

25

Chapter 25: Oracle Database Tuning


Introduction to Index

If the working ability of the database is to be greatly improved, the hardware facilities of the server must be upgraded. According to IT industry statistics
like
According to statistics, 70% of the improvement of database capacity depends on the quality of server hardware. In the remaining 30% that can be manually t
Inside is the space for database managers to show their skills.
In terms of improving system optimization by hardware and management personnel, many people think that the skills of management personnel are more imp
As much as 90% of the proportion of system optimization. For this discussion, we can draw an analogy: if the hardware is a house, the application
The system is like furniture and decoration. If the house has been given, the manager's job is just how to adjust the position of the furniture
The location makes the house look more pleasing to the eye and more comfortable. Hardware facilities, for application software, if the facilities are too good, it is a
resources, but it is better than a house too small, too much furniture, difficult to arrange the dilemma. Many times, data administrators and system administrators
There is no way for the staff to have decisive rights to the configuration of the hardware. What they can do is to implement the
optimized to the maximum.
The industry has also conducted a survey on the division of this space that can be improved artificially, and the results are shown in Figure 25-1.

Figure 25-1 Division of optimization space

As can be seen from Figure 25-1, among the parts that can be adjusted manually, 60% of the problems occur in the SQL part; 20% of the problems occur in the
The problem occurs in the design part of the database. Both parts are done by the developer. as a real database administrator
DBA, the tuning and adjustment of the database can only achieve a maximum of 18% of the human-adjustable share, accounting for 5.4% of the entire system adju
That's all. System administrators accounted for an even smaller share, just 2% of human system adjustments, accounting for 0.6% of the overall system.
Therefore, the joke in the industry is that the optimal state required by the system is achieved in this way:

352 Oracle Database Performance Optimization


Optimal state of the system = money + good developers + good DBA
For the project budget that cannot be controlled by technicians, only reference opinions can be provided for the hardware selection of the server. Therefore,
The state of the system can only be done this way:
System status = good developers + good DBAs
As for the current state of many databases that are not in good condition, it can only be described as:
System State = state when the developer submitted the project
There are many reasons for SQL and design problems in developer submissions. For example, some developers do not have
Received formal computer professional training, do not understand the processing process of computer algorithms; or some developers, just write standard
The program is suitable for SQL of all databases, instead of developing a program that can be applied to Oracle databases based on the characteristics of Oracle d
The optimal SQL statement on the database. In addition, for the program submitted by the development department, even if the test department has done enough
There are many problems. These programs have not been tested in a real production environment, and many problems have not been exposed. even though
A database that has been in production mode after 30 days of trial operation in a real production environment will have similar problems.
For example, for programs that are rarely used in trial operation, or performance problems that only appear as the amount of data continues to increase, DBA daily
problems that often need to be faced. As for the SQL program problem, it can also be solved by tuning the SQL, but the problem existing in the database design
It is very difficult to solve the problem of calculation, and it usually involves the whole body with one move.
Therefore, for a DBA, in addition to tuning the maintenance database (the 18% part), the daily work is very difficult.
A large part of the work is to help developers tune the SQL programs that are running in the application.
In many cases, not only the SQL program submitted by the company's development department personnel has problems, but also the SQL program submitted
There are also some problems with SQL programs. I originally thought that the program submitted by a large manufacturer like PeopleSoft should be fully tested.
Try it, you can totally trust it. But the last problem I encountered, which kept me busy for two weeks, turned out to be PeopleSoft
There are actually 3 dead loops in a package of the submitted annual report. Every time it runs, after three or four hours, rollback
The segment will definitely explode, because the size of the generated rollback segment has exceeded the sum of the data in the related table several times
h d h d h k d b h h k h ld h b d f f fi
up. In the end, I had to cut this package into pieces and run it piece by piece, so that the work that could have been done in a few minutes was run from start to fini
for 2 days.
After working as a DBA for several years, I feel that complex skills and advanced knowledge are needed to solve the problems encountered.
Many, relatively speaking, in the case of a clear understanding of the basic concepts, the entry point to solve the problem is usually more accurate. for
For technical articles written for others, I always tend to introduce some basic and essential things, hoping to help more people.
The introduction to the Oracle index (index) involved in this chapter is very basic and essential.

25.1 The role of the index

Index (Index), as the name suggests, is the fastest path to find the required data. In SQL tuning, the use of indexes,
Is a convenient way to avoid a full table scan of the table being queried when performing a query operation. When updating the data or
Or delete operation, the use of indexes can also improve performance.
Another function of the index is to enforce the control of data integrity. As we all know, in two cases, the system will automatically
The columns of the table are indexed:
(1) When the column of the table is designated as the primary key.
(2) When the column of the table has a unique constraint.
When a foreign key exists in a table, it is usually recommended to use an index for this column. When inserting data into a table
When checking whether the inserted data is duplicated with the existing data, it is the index check of the columns of PK and UK. When FK

Chapter 25 Introduction to Oracle Database Optimization Index (Index) 353

When there is an index on the column, if you insert or update data to its parent table, it is not the child table that is locked, but the FK column of the child table
face index. However, Oracle has gradually changed some operating methods since version 9i.

25.2 Frequently asked questions about index management

Listed below are some frequently asked questions about index management for your reference.

1. Has the database been analyzed recently?

For applications using the Oracle Cost Based Optimizer (CBO), for databases in daily use, it is recommended
The entire database is analyzed every day. Of course, this is based on the fact that the database is not very large. Generally, the analysis can take 30 to 60 minutes
Finished around. If it is a large database, it is enough to analyze only the tables with large data changes every day, and for static tables that do not change
The table does not need to be analyzed every day.
In Oracle version 7.x, Oracle provides two methods of table analysis: ANALYZE DBMS_UTILITY

Oracle, starting with its version 8.1.5, recommends using the DBMS_STATS package. It is worth noting that many DBAs reflect
It is said that the DBMS_STATS package has many bugs. My environment currently still uses ANALYZE and DBMS_UTILITY.
If the analysis work of the database is run regularly every day, when a performance problem occurs, can it be ignored?
Is there a problem with statistics?
In fact, it is still necessary to check the time when the table and index were last analyzed. If a table happens to be done that day
drop/import, the unanalyzed data of that table exists in the system table. If it happens that this table is a large query
Correlation table needed, which is likely to be bad. If you are not sure whether someone has moved the database, check the table score
The time for analysis is mostly beneficial and harmless.

2. number of indexes

Many programmers believe that all columns in where clauses should be indexed. This kind of thinking is wrong. Overbuilt
Indexing, and too few indexes will greatly affect the performance of the database.
Why does too much indexing affect performance?
When insert/update/delete operations are performed on the data in the table, the data in the index will also be updated accordingly. if not one
For a read-only table, an index needs a balance point to improve performance or reduce performance for query and update data. and
This balance is difficult to grasp. Remember the information I read many years ago, Oracle recommends that the columns of the index should not exceed the numb
40% of the number of columns. Another question derived from this topic is when to build an index and what kind of index to build
Improving the performance of the database is the most beneficial, which is a rather complicated issue.
If the entire table really needs to be indexed, consider whether IOT (Indexed Organized Table) is possible. IoT
Applicable to lookup data, search by PK to force data to be sorted according to PK to provide better clustering factor,
Reduce the cost of range scan. Therefore, IOT also has many restrictions. For example, the data in the table should preferably be static. It is recommended that the
Don't wait too long.
354 Oracle Database Performance Optimization

3. Are you using the correct index type

There are many kinds of indexes, and not all databases support all kinds of indexes. Commonly used are the following. B-Tree: The most commonly used inde

All books on data structures and algorithms. FBI (Function Based Index): When the function is used in the where statement, the B-tree index cannot be used.

The way to change is to use the FBI index. Updating the FBI is relatively expensive for a table that is updated frequently
Affection. Also, Rule Based Optimizer does not support FBI indexes. Bitmap: Bitmap index is not supported by all databases, and Oracle database is only supporte

Support for Bitmap indexing. Bitmap indexes are suitable for tables that are read statically, and the columns on which the indexes reside are low cardinality. data w
The environment is the best environment for the Bitmap index to function.

4. Situations where indexes are not used

Many times, the correct column of the table has the correct index, but some queries use the index on the column, and
Without being used, queries are unacceptably slow. Oracle explains that there are many situations that lead to Oracle's optimization
The Optimizer cannot use the index. At this time, you need to modify the SQL to force the SQL statement to use the index. now only
We only know that in the following situations, the index is not used, and the affected tables must be retrieved from the full table (full table
scan).
Here we use the table scott.emp to do the experiment, in addition to the primary key above the original empno, in comm, mgr,
Indexes are also created on the three columns of the job:
SQL> select table_name, index_name, column_name from user_ind_columns where table_name='EMP';

TABLE_NAME INDEX_NAME COLUMN_NAME


--------------- --------------- ---------------
EMP PK_EMP EMPNO
EMP COMM_TST ​
COMM
EMP MGR_TST MGR
EMP JOB_TST JOB

SQL> DESC EMP Name Null? Type -------------------------------------------- - ------- ---------------------------- EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(

SQL> select * from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO

---------- ---------- --------- ---------- --------- -- -------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-80 800 20

Chapter 25 Introduction to Index (Index) for Oracle Database Optimization 81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-

14 rows selected.

SQL> set autotrace on;


(1) When comparing two columns (empno and mgr) in the same table, the index (pk_emp and mgr_tst)
is sometimes not used:
SQL> select * from emp where empno<mgr; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO

---------- ---------- --------- ---------- --------- -- -------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-80 800 20 7499 ALLEN SALESMAN 7698 20-
7 rows selected.

Execution Plan
-------------------------------------------------- -------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=8 Bytes=296 ) 1 0 TABLE ACCESS (FULL) OF 'E

Statistics
-------------------------------------------------- -------- 1 recursive calls 0 db block gets 8 consistent gets 0 physical reads 0 redo size 1043 bytes se

356 Oracle Database Performance Optimization 0 sorts (memory) 0 sorts (disk) 7 rows processed

(2) Null value. Normally, Null values ​do not exist in the index. If is null or is not appears in the where statement
When null, the index cannot be used (comm._tst is not used).
SQL> select * from emp where comm is not null; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO

---------- ---------- --------- ---------- --------- -- -------- ---------- ---------- 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7521 WARD SALESMAN 7

Execution Plan
-------------------------------------------------- -------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=4 Bytes=148 ) 1 0 TABLE ACCESS (FULL) OF 'E

Statistics
-------------------------------------------------- -------- 0 recursive calls 0 db block gets 8 consistent gets 0 physical reads 0 redo size 902 bytes sen

(3) When there is a not function in the where statement, such as not in, not exist, column <> value, column1
In the case of > value or column2 < value, the index cannot be used.

SQL> select * from emp where comm <> 1000; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO

---------- ---------- --------- ---------- --------- -- -------- ---------- ---------- 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7521 WARD SALESMAN 7

Execution Plan
Chapter 25 Introduction to Oracle Database Optimization Index (Index) 357
-------------------------------------------------- -------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=3 Bytes=111 ) 1 0 TABLE ACCESS (FULL) OF 'E

Statistics
-------------------------------------------------- -------- 1 recursive calls 0 db block gets 8 consistent gets 6 physical reads 0 redo size 902 bytes sen

(4) When the single-row function is used, such as nvl, to_char, lower, etc., the index cannot be used.
SQL> select ename, nvl(comm, 0) from emp;

ENAME NVL(COMM,0)
---------- -----------
SMITH 0
ALLEN 300
WARD 500
JONES 0
MARTIN 1400
BLAKE 0
CLARK 0
SCOTT 0
KING 0
TURNER 0
Adams 0
JAMES 0
FORD 0
MILLER 0

14 rows selected.

Execution Plan
-------------------------------------------------- -------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=14 Bytes=11 2) 1 0 TABLE ACCESS (FULL) OF '

358 Oracle Database Performance Optimization


Statistics
-------------------------------------------------- -------- 1 recursive calls 0 db block gets 8 consistent gets 0 physical reads 0 redo size 623 bytes sen

(5) When using the wildcard symbol % or _ as the first character of the query string, for example, in the statement "where name
like ' %xxxx ' ", the index cannot be used (for this case, many databases now support the so-called "full-text
Retrieve Index", can solve this problem well). However, if the first word of the query string is determined, such as "where name
like ' a% ' ", you can use the index.
SQL> select ename, job from emp where job like '%C%';

ENAME JOB
---------- ---------
SMITH CLERK
Adams Clerk
JAMES CLERK
MILLER CLERK

Execution Plan
-------------------------------------------------- -------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=1 Bytes=14) 1 0 TABLE ACCESS (FULL) OF 'EMP
Statistics
-------------------------------------------------- -------- 1 recursive calls 0 db block gets 8 consistent gets 0 physical reads 0 redo size 497 bytes sen

SQL> select ename, job from emp where job like 'C%';

ENAME JOB

Chapter 25 Introduction to Oracle Database Optimization Index (Index) 359

---------- ---------
SMITH CLERK
Adams Clerk
JAMES CLERK
MILLER CLERK

Execution Plan
-------------------------------------------------- -------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=3 Bytes=42) 1 0 TABLE ACCESS (BY INDEX ROWI

Statistics
-------------------------------------------------- -------- 1 recursive calls 0 db block gets 4 consistent gets 1 physical reads 0 redo size 497 bytes sen

5. index rebuild

The so-called index rebuilding generally refers to rebuilding the B-Tree index. For tables that are frequently updated, when inserting data,
Attached to the back of the index block (block) above the corresponding PCTFREE List, if the data contained in this block reaches the PTCFREE
According to the regulations, the block where the index data is located will be split into two. To a certain extent, the B-Tree index may be deepened by one level (sp
move down to next level). When a table deletes a lot of data, the space occupied by these data in the index cannot
was released for reuse.
For what kind of situation, the table must be rebuilt. Long ago, Oracle once suggested that in the following two situations,
Index needs to be rebuilt: When the index has more than 4 levels. The deleted data in the index exceeds 20% of the total index data (because this data is analyzed f

In many cases, the results of table and index analysis force the CBO to use these results for SQL optimization.
calculation).
SQL> analyze index abcd validate structure;
SQL> select (del_lf_rows_len/lf_rows_len)*100 as index_usage From index_stats Where index_name = 'ABCD';

In recent materials, Oracle no longer gives the criteria for rebuilding the index, and it seems that it depends on the wishes of the DBA to decide whether to rebu
index.
360 Oracle Database Performance Optimization
For the database I manage, I use the simplest method to judge whether the index needs to be rebuilt. The databases I manage,
Indexes are concentrated in 2 to 3 table spaces (tablespace). I use the tablespace management tool Tablespace Map in EM
Analyze the table space, and if there is a red flag in the index, I will rebuild the index. So far this method is very economical
Save time and effort.

Indexes that need to be rebuilt

Figure 25-2 Indexes that need to be rebuilt

25.3 Index Management

Next, there are several issues that need to be paid attention to in actual operation.

1. How to find out that the table has too few indexes

This problem seems to be very simple. If full table scan is displayed on the explain plan, and the relevant columns have no indexes,
And you need to create an index, so please create one.
If it is an infrequently used query, or a one-time query, if it takes half an hour to build an index, the query can be
The running time is shortened by 2 hours, or 3 hours, or more, you can consider creating a temporary index first, and after running
Delete it later.

2. How to find out that the table has too many indexes

This problem is much more troublesome, and it is usually necessary to check the tables one by one to find the problem. For a number with only three or four ta
According to the database, it may not be difficult to check the tables one by one. For a database with two or three hundred tables, it can be done by filtering it caref
For a database in an ERP environment, it is almost an impossible task. The new version of the PeopleSoft Financial database,
The number of tables is as high as more than 7000, and the number of indexes has reached 5000. Too many indexes are a common problem. but for this
The package software provided by this manufacturer, the DBA can hardly make any changes.
Therefore, it is found that the performance problems caused by too many indexes on the table are usually only for applications developed by the company, or w
When the user cannot bear the performance problem, it is possible to find the root of the problem, and the solution must also be developed

Chapter 25 Introduction to Oracle Database Optimization Index (Index) 361

After the approval of the personnel, jointly determine the improvement method. Generally speaking, the DBA is unable to understand the details of many applicatio
Objects created by others must never be easily deleted, even if the DBA is sure that the Object is useless.
The way to find that there are too many indexes in a table is to list all the indexes in a table. Find out if there are duplicate indexes created,
If there is an index with the same function, then delete it.
Starting from the 9i version of the Oracle database, the function of monitoring whether the index is used has been added, so that the database administrator c
Easily find indexes that are never used, or rarely used. This function is the following SQL command:
Alter index <index_name> monitoring usage;
Alter index <index_name> nomonitoring usage;
Pay attention to the bug of Index Monitoring, which cannot monitor the index of Sys. Oracle announced the revision after version 9.2.0.5
Corrected this problem. In addition, the index that is not used is displayed. If it is a Unique Index, it may not be able to Drop. Some are for
Needed by Unique Constraint.
Oracle recommends using it only when you need to monitor index usage. While monitoring does not cause any major performance issues,
However, every time index monitoring is used, the relevant part of the index in the explain plan must be run repeatedly, instead of
Reuse the already generated explain plan.

3. rebuild index

Since Oracle supports the rebuild online function, generally smaller indexes can be rebuilt at any time
Online is no longer a problem. The main aspect is how to judge whether the index needs to be rebuilt (discussed earlier).
For relatively large indexes, it is recommended to do it during non-busy hours. rebuild takes slightly longer to run than rebuild online
Be quick.

4. EZSQL by John H. Dorlon: A small Oracle database management tool

(Thanks to Mr. You Lixin, the super moderator of itpub.net easyfree, for providing the EZSQL tool)
EZSQL This small tool is the predecessor of Quest's famous management tool TOAD. In Quest Corporation to EZSQL's
The inventor John Dorlon bought out EZSQL and invited him to join Quest to continue developing TOAD. Before EZSQL was
Free download to use. EZSQL is a very small tool with a total size of only 1.57 MB, but it is small and full of internal organs.
Complete. Among them, the GUI interface for monitoring index usage status is simple and easy to use, as shown in Figure 25-3.
When writing this article, I searched the Internet and found that there are two versions available for download on oradb.net
Download, the address is as follows. http://www.oradb.net/book/Ezsql2.3.15.6677.rar http://www.oradb.net/book/19818ezsqlexe.zip

5. DB Expert for Oracle by LECCO

DB Expert for Oracle also has strong functions in adjusting and monitoring indexes. But this tool requires payment
of. In addition, LECCO has been acquired and merged by Quest. I don't know the current upgrade status of this software, and
The cost of the purchase.
The index monitoring function of DB Export for Oracle is shown in Figure 25-4.
The index tuning function of DB Export for Oracle is shown in Figure 25-5.

362 Oracle Database Performance Optimization

Figure 25-3 EZSQL by John H. Dorlon interface

Figure 25-4 Index monitoring

Figure 25-5 Index tuning

Chapter 25 Introduction to Oracle Database Optimization Index (Index) 363


25.4 Some index management scripts

1. List the indexes that need to be rebuilt (script source: MetaLink)

REM =================================================== =============


REM
REM rebuild_indx.sql
REM
REM Copyright (c) Oracle Software, 1998 - 2000
REM
REM Author : Jurgen Schelfhout
REM
REM The sample program in this article is provided for educational
REM purposes only and is NOT supported by Oracle Support Services.
REM It has been tested internally, however, and works as documented.
REM We do not guarantee that it will work for you, so be sure to test
REM it in your environment before relying on it.
REM
REM This script will analyze all the indexes for a given schema
REM or for a subset of schema's. After this the dynamic view
REM index_stats is consulted to see if an index is a good
REM candidate for a rebuild or for a bitmap index.
REM
REM Database Version : 7.3.X and above.
REM
REM =================================================== =============

prompt
ACCEPT spoolfile CHAR prompt 'Output-file : ';
ACCEPT schema CHAR prompt 'Schema name (% allowed) : ';
prompt
prompt
prompt Rebuild the index when:
prompt - deleted entries represent 20% or more of the current entries
prompt - the index depth is more then 4 levels.
prompt Possible candidate for bitmap index :
prompt - when distinctiveness is more than 99%
prompt
spool &spoolfile

set server output on


set verify off
declare c_name INTEGER; ignore INTEGER; height index_stats.height%TYPE := 0; lf_rows index_stats.lf_rows%TYPE := 0; del_lf_rows index_stats.del_lf_rows%TY

364 Oracle database performance optimization cursor c_indx is select owner, table_name, index_name from dba_indexes where owner like upper('&schema') and owne

begin dbms_output.enable (1000000); dbms_output.put_line ('Owner Index Name % Deleted Entries Blevel Distinctiveness'); dbms_output.put_line ('------- ---

--
-- Index is considered as candidate for rebuild when:
-- - when deleted entries represent 20% or more of the current entries
-- - when the index depth is more then 4 levels.(height starts counting from 1 so > 5)
-- Index is (possible) candidate for a bitmap index when:
-- - distinctiveness is more than 99%
-- if ( height > 5 ) OR ( (del_lf_rows/lf_rows) > 0.2 ) then dbms_output.put_line (rpad(r_indx.owner,16,' ') || rpad(r_indx.index_name,40,' ') || lpad (ro

lpad(round((lf_rows-distinct_keys)*100/lf_rows,3),16,' ')); end if; end loop; DBMS_SQL.CLOSE_CURSOR(c_name);


end;
/

spool off
set verify on

2. Move indexes from one tablespace to another

alter index rebuild tablspace <target tablespace name> [online];

3. Monitor the usage of an index

--************************************************ ***************************
--Copyright 2004 by Rampant TechPress Inc.
-- Free for non-commercial use!
-- To license, e-mail [email protected]

Chapter 25 Introduction to Oracle Database Optimization Index (Index) 365


--************************************************ ***************************
col c1 heading 'Begin|Interval|time' format a20
col c2 heading 'Search Columns' format 999
col c3 heading 'Invocation|Count' format 99,999,999

break on c1 ship 2

accept idxname char prompt 'Enter Index Name: '

ttile 'Invocation Counts for index|&idxname'

select
to_char(sn.begin_interval_time, 'yy-mm-dd hh24') c1,
p. search_columns c2,
count(*) c3
from
dba_hist_snapshot sn,
dba_hist_sql_plan p,
dba_hist_sqlstat st
where
st.sql_id = p.sql_id
and
sn.snap_id = st.snap_id
and
p.object_name = '&idxname'
group by
begin_interval_time, search_columns;

About the Author


Chen Yuhong, net name snowwhite2000, snow, Bai Xuehongchen, current moderator of ITPUB database management version. Always
As the DBA of the production system of a foreign-funded enterprise, participated in the planning and implementation of several projects. Currently serving
PeopleSoft ERP system DBA, implementation and application of Oracle products in the production environment, MS SQL Server and other data
I have more experience in the management of the production environment system of the library.
Zhu Chao, whose screen name is chao_ping, is the current moderator of the ITPUB database management version, active in the ITPUB database man
UNIX System Management Edition, NetEase Oracle Database Edition and other database BBS. Worked as SAP in a well-known company in Beijing
ERP system application DBA, currently working in Shanghai, as DBA of a well-known large-scale website in China. Implementation of enterprise ERP syste
implementation, operation and management of very large databases, performance tuning, high availability of databases, SQL optimization and UNIX oper
System and other aspects have very in-depth research and rich experience.

You might also like