Balanced Decision on Index Creation [message #164933] |
Mon, 27 March 2006 12:44 |
faiz_hyd
Messages: 294 Registered: February 2006
|
Senior Member |
|
|
Hi
I have a table with 9 column, right now there is only 1 Unique index on Primary Key Column, Daily inserts around 50000 rows in this table through Procedure from Front End, Out of these 9 column 4 columns are frequently used in Queries and select statements, Now if i create indexes
will insertion get slow and performance of Queries will be better or vice versa..
How can i balance myself and decide whether to create index or not,If i create insertion will be slow, if i don't Select and queries are slow, How to take balanced decision.
Thanks
[Updated on: Mon, 27 March 2006 12:52] Report message to a moderator
|
|
|
|
Re: Balanced Decision on Index Creation [message #164936 is a reply to message #164935] |
Mon, 27 March 2006 13:19 |
faiz_hyd
Messages: 294 Registered: February 2006
|
Senior Member |
|
|
Hello
Thanks Mahesh Sir
Well it is a C# front end, using Oracle Stored Procedure, As the figure 50000 i said is maximum per day, it gets' client details and region and loads data in this table, It is not a Batch job,
Performance queries are bit slow takes time, and insertion also takes time as per developer, so first look i thouhgt indexes missing.
If i understand you correctly
"Just collect the statisitcs frequently.
I would first try it in a test environment. Measure the performance. See how much 'slower' your inserts will happen.
"
You are suggesting to create the index and try to see the behaviour of Queries and insertion !.
Thanks
|
|
|
|
Re: Balanced Decision on Index Creation [message #164947 is a reply to message #164937] |
Mon, 27 March 2006 14:29 |
faiz_hyd
Messages: 294 Registered: February 2006
|
Senior Member |
|
|
Mahesh Sir
Please have a look at this query,
Even though all the column in where clause is having indexes this statement is doing FTS,what is wrong
SELECT DISTINCT WRK_TYPE_CD FROM WRK_QU WHERE SRC_NODE_NM = :B2
AND INPT_QU_STS_CD= 'd' AND WRK_TYPE_CD <> 'U' AND FILE_RCV_TS <
= :B1
PLAN
Operation | PHV/Object Name | Rows | Bytes| Cost |
--------------------------------------------------------------------------------
|SELECT STATEMENT |----- 2112212973 ----| | | 1691 |
|SORT UNIQUE | | 1 | 21 | 1691 |
| TABLE ACCESS FULL |WRK_QU | 23K| 487K| 1635 |
The DBA said "22 million physcial reads in one hour"
What can be done to avoid FTS so that it improves.
Thanks
|
|
|
|
Re: Balanced Decision on Index Creation [message #165141 is a reply to message #164961] |
Tue, 28 March 2006 08:28 |
faiz_hyd
Messages: 294 Registered: February 2006
|
Senior Member |
|
|
Hello Mahesh Sir
The answers are
Count :- 450000
Distinct :- 800
This Query will get maximum of 5 rows
How to check for HWM or reduce Disk/Physical Reads.
Stats are updated daily at 5 A.M.
Any thing i can do on this.
Thanks
|
|
|
|
Re: Balanced Decision on Index Creation [message #165163 is a reply to message #165147] |
Tue, 28 March 2006 11:25 |
faiz_hyd
Messages: 294 Registered: February 2006
|
Senior Member |
|
|
Hello Mahesh Sir
One more thing i wanted to add on to it is from this deletes are also happening at regular interval of time from the procedure, let's say around 10000-20k rows per day , at a time maximum of 450000 rows will be there.
If i do alter table movetable space does index goes, so how i have to keep track of it, Does altering table will help
solving HWM.
I added Hints so plan got changed, it is doing Index Scan and avoiding FTS also.
SELECT /*+ Index(a,XIE_WRKQU_FILRCVTS)*/ DISTINCT WRK_TYPE_CD,SRC_NODE_NM ,INPT_QU_STS_CD
FROM WRK_QU a WHERE FILE_RCV_TS <=to_date('10-mar-2006') AND WRK_TYPE_CD <> 'U'
and SRC_NODE_NM = 'NEO1W014'
AND INPT_QU_STS_CD= 'd'
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=CHOOSE 36 245284
SORT UNIQUE 36 756 245284
TABLE ACCESS BY INDEX ROWID R1APP.WRK_QU 19 K 395 K 245237
INDEX RANGE SCAN R1APP.XIE_WRKQU _FILRCVTS 396 K 1056
Thanks
[Updated on: Tue, 28 March 2006 11:37] Report message to a moderator
|
|
|
|
|
|