Anda di halaman 1dari 8

PERFORMANCE ON COMPOUND COLUMN INDEXES Author JP Vijaykumar Date May 08 2013 Created a table and populated the table.

Created a compount column index on columns temp_jp(col1,col2,col3). Do I need to use all these three columns in my compound column index for better performance? What will be the impact if I use the columns col1 only OR col1 and col3, in my queries' where condition? To answer these questions, I ran the following queries A-D on my table and the resultant values for each of the tests were tabulated hereunder: Between each query's execution, the db was restarted. TEST TEST TEST TEST

A) select count(1) from temp_jp where col1=890343; B) select count(1) from temp_jp where col1=890343 and col3='VEEKSHA'; C) select count(1) from temp_jp where col1=890343 and col2 is not null and col3='VEEKSHA'; D) select count(1) from (select col3 from temp_jp where col1=890343) where col3='VEEKSHA';

LATCH.AQ deq hash table latch LATCH.ASM db client latch LATCH.ASM map operation hash table LATCH.ASM network state latch LATCH.Change Notification Hash table latch LATCH.Consistent RBA LATCH.DML lock allocation LATCH.Event Group Locks LATCH.FOB s.o list latch LATCH.File State Object Pool Parent Latch LATCH.I/O Staticstics latch LATCH.IPC stats buffer allocation latch LATCH.In memory undo latch LATCH.JS Sh mem access LATCH.JS queue access latch LATCH.JS queue state obj latch LATCH.JS slv state obj latch

1 40 1 1 20 9 25 1 3 1 1 1 44 1 1 432 -3

1 129 1 3 65 36 105 3 3 1 1 1 226 3 3 1492 5

1 51 1 2 25 9557 38195 4 3 1 1 1 62990 3 3 626 9

1 2965 1 62 1230 189441 1025341 61 343 1 1 1 1749425 19 46 27708 51

LATCH.KFC FX Hash Latch LATCH.KFC Hash Latch LATCH.KFCL LE Freelist LATCH.KGNFS-NFS:SHM structure LATCH.KGNFS-NFS:SVR LIST LATCH.KJC message pool free list LATCH.KJCT flow control latch LATCH.KMG MMAN ready and startup request latch LATCH.Locator state objects pool parent latch LATCH.Lsod array latch LATCH.Memory Management Latch LATCH.Memory Queue LATCH.Memory Queue Message Subscriber #1 LATCH.Memory Queue Message Subscriber #2 LATCH.Memory Queue Message Subscriber #3 LATCH.Memory Queue Message Subscriber #4 LATCH.Memory Queue Subscriber LATCH.Mutex LATCH.Mutex Stats LATCH.OS process

1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 7

1 1 1 1 1 1 1 64 1 1 1 1 1 1 1 1 1 1 1 19

1 1 1 1 1 1 1 25 1 1 1 1 1 1 1 1 1 1 1 19

1 1 1 1 1 1 1 1231 1 1 1 1 1 1 1 1 1 1 1 442

LATCH.OS process allocation


LATCH.OS process: request allocation LATCH.PL/SQL warning settings LATCH.PX hash array latch LATCH.QMT LATCH.SGA IO buffer pool latch LATCH.SGA blob parent LATCH.SGA bucket locks LATCH.SGA heap locks LATCH.SGA pool locks LATCH.SQL memory manager latch LATCH.SQL memory manager workarea list latch LATCH.Shared B-Tree LATCH.Streams Generic LATCH.Testing LATCH.Token Manager LATCH.WCR: sync LATCH.Write State Object Pool Parent Latch LATCH.XDB NFS Security Latch LATCH.XDB unused session pool LATCH.XDB used session pool LATCH.active checkpoint queue latch LATCH.active service list LATCH.begin backup scn array LATCH.buffer pool LATCH.business card LATCH.cache buffers chains LATCH.cache buffers lru chain

114
2 6 1 1 1 1 1 1 1 2 1348 4 1 1 1 1 1 1 1 1 60 123 1 1 1 8662 137

372
4 9 1 1 1 1 1 1 1 6 4298 8 1 1 1 1 1 1 1 1 194 405 1 1 1 55143 140

151
3 10 1 1 11 1 1 1 1 2 1632 4 1 1 1 1 1 1 1 1 163 184 4 1 1 951450 1050

7177
121 313 1 1 384 1 1 1 1 123 80432 133 1 1 1 1 1 1 1 1 117630 7773 28 1 1 34597796 50414

LATCH.cache table scan latch


LATCH.call allocation

35
34

35
41

17
26

108502
1464

LATCH.cas latch LATCH.change notification client cache latch LATCH.channel handle pool latch LATCH.channel operations parent latch LATCH.checkpoint queue latch LATCH.client/application info LATCH.cp cmon/server latch LATCH.cp pool latch LATCH.cp server hash latch LATCH.cp sga latch LATCH.cvmap freelist lock LATCH.deferred cleanup latch LATCH.dml lock allocation LATCH.done queue latch LATCH.dummy allocation LATCH.enqueue hash chains LATCH.enqueues LATCH.fifth spare latch LATCH.file cache latch LATCH.flashback copy LATCH.fourth Audit Vault latch LATCH.gc element LATCH.gcs commit scn state LATCH.gcs partitioned table hash LATCH.gcs pcm hashed value bucket hash LATCH.gcs resource freelist LATCH.gcs resource hash LATCH.gcs resource scan list LATCH.gcs shadows freelist LATCH.ges domain table LATCH.ges enqueue table freelist LATCH.ges group table LATCH.ges process hash list LATCH.ges process parent latch LATCH.ges resource hash list LATCH.ges resource scan list LATCH.ges resource table freelist LATCH.ges value block free list LATCH.global tx hash mapping LATCH.granule operation LATCH.hash table modification latch LATCH.heartbeat check LATCH.internal temp table object number allocation latch LATCH.intra txn parallel recovery LATCH.io pool granule metadata list LATCH.job workq parent latch LATCH.job_queue_processes parameter latch LATCH.k2q lock allocation LATCH.kdlx hb parent latch LATCH.kgb parent

1 1 4 327 7684 1 1 1 1 1 1 1 2 1 3 1104 1042 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 13 1 1 1

1 1 7 927 27887 12 1 1 1 3 1 3 4 1 7 3625 3390 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 2 44 1 1 1

1 1 5 380 13122 13 1 1 1 2 1 2 3 1 6 60671 3046 1 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 18 1 1 1

1 1 153 23326 1898635 303 1 1 1 62 1 62 215 1 152 1895576 277943 1 396 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 102 1 1 1 1 16 825 1 1 1

LATCH.kgnfs mount latch LATCH.kokc descriptor allocation latch LATCH.ksfv messages LATCH.ksim group membership cache LATCH.kss move lock LATCH.ksuosstats global area LATCH.ksv allocation latch LATCH.ksv class latch LATCH.ksv msg queue latch LATCH.ksz_so allocation latch LATCH.ktm global data LATCH.kwqbsn:qsga LATCH.lgwr LWN SCN LATCH.loader state object freelist LATCH.lob segment dispenser latch LATCH.lob segment hash table latch LATCH.lob segment query latch LATCH.lock DBA buffer during media recovery LATCH.logical standby cache LATCH.logminer context allocation LATCH.logminer work area LATCH.longop free list parent LATCH.mapped buffers lru chain LATCH.message pool operations parent latch LATCH.messages LATCH.mostly latch-free SCN LATCH.msg queue latch LATCH.multiblock read objects LATCH.name-service namespace bucket LATCH.ncodef allocation latch LATCH.object queue header heap LATCH.object queue header operation LATCH.object stats modification LATCH.parallel query alloc buffer LATCH.parallel query stats LATCH.parameter table management LATCH.peshm LATCH.pesom_free_list LATCH.pesom_hash_node LATCH.post/wait queue LATCH.process allocation LATCH.process group creation LATCH.process queue LATCH.process queue reference LATCH.qmn task queue latch LATCH.query server freelists LATCH.queuing load statistics LATCH.recovery domain hash list LATCH.redo allocation LATCH.redo copy

1 6 1 1 1 4 1 1 1 2 4 3 26 3 1 1 1 1 1 1 1 1 1 1 610 26 1 72 1 1 571 1042 26 9 1 2 1 1 1 6 2 2 1 1 16 1 1 1 126 1

1 6 1 1 1 10 3 1 1 4 5 7 76 3 1 3 1 1 1 1 1 1 1 3 2008 76 1 72 1 3 1637 2143 26 25 1 23 1 1 1 45 6 4 1 1 28 1 1 1 372 1

1 6 1 1 3 5 5 3 1 3 8 3 9568 44 1 1 1 1 1 1 1 1 1 3 29855 9569 1 236 1 2 1322 10165 13 13 1 22 1 1 1 14641 6 3 1 1 12 1 1 1 59043 1

1 6 1 1 37 204 133 71 1 121 103 132 189936 1039 1 13 1 1 1 1 1 250 1 748 740584 190168 1 459131 1 62 933625 7722488 1189 477 1 440 1 1 1 329356 164 121 1 1 538 1 1 1 1674926 1

LATCH.redo writing LATCH.resmgr:active threads LATCH.resmgr:actses change group LATCH.resmgr:actses change state LATCH.resmgr:free threads list LATCH.resmgr:plan CPU method LATCH.resmgr:resource group CPU method LATCH.resmgr:schema config LATCH.resmgr:session queuing LATCH.rm cas latch

128 14 1 1 2 1 7 12 1 1

431 47 2 1 6 1 17 41 1 1

28883 22 3 5 5 1 268 17 1 1

687178 916 51 67149 151 1 328943 777 1 1

LATCH.row cache objects


LATCH.second Audit Vault latch LATCH.second spare latch LATCH.sequence cache LATCH.session allocation LATCH.session idle bit LATCH.session queue latch LATCH.session state list latch LATCH.session switching LATCH.session timer

3943
1 1 10 30 160 1 3 12 20

4227
1 1 14 263 2022 1 13 14 65

4068
1 1 19 9819 88509 1 15 3 25

124569
1 1 182 264852 2384426 1 229 368 1234

LATCH.shared pool
LATCH.shared pool sim alloc LATCH.shared pool simulator LATCH.sim partition latch LATCH.simulator hash latch LATCH.simulator lru latch LATCH.sort extent pool LATCH.space background task latch LATCH.tablespace key chain LATCH.temp lob duration state obj allocation LATCH.temporary table state object allocation LATCH.test excl. parent l0 LATCH.test excl. parent2 l0 LATCH.third spare latch LATCH.threshold alerts latch LATCH.transaction allocation LATCH.undo global data LATCH.virtual circuit buffers LATCH.virtual circuit holder LATCH.virtual circuit queues STAT..CPU used by this session STAT..CPU used when call started STAT..DB time

3255
3 149 1 240 1 18 44 2 1 1 1 1 1 2 7 43 1 1 1 25 39 65

3452
1 145 1 1694 1 20 307 2 1 1 1 1 1 5 14 226 1 1 1 21 41 62

2645
1 148 1 14582 1 763 127 2 1 1 1 1 1 1 17 51456 1 1 1 21 21 88

65795
22 2635 1 1254014 1 37833 4133 401 1 1 1 1 1 122 616 1543184 1 1 1 23 31 586

STAT..Elapsed Time
STAT..HSC Heap Segment Block Changes STAT..Heap Segment Array Updates STAT..IMU Flushes STAT..IMU ktichg flush STAT..IMU undo allocation size STAT..SQL*Net roundtrips to/from client

5991
15 2 1 1 52 17

19381
14 2 1 1 52 17

7393
14 2 1 1 52 16

370518
14 2 2 1 52 16

STAT..buffer is not pinned count STAT..buffer is pinned count STAT..bytes received via SQL*Net from client STAT..bytes sent via SQL*Net to client STAT..calls to get snapshot scn: kcmgss STAT..calls to kcmgas STAT..calls to kcmgcs

3521 313 4349 4923 1029 17 67

3446 294 4390 4976 1012 17 70

2501 265 4422 4792 685 17 39

3317 294 4424 4769 1019 26 51

STAT..cell physical IO interconnect bytes STAT..cluster key scan block gets


STAT..cluster key scans STAT..commit batch/immediate performed STAT..commit batch/immediate requested STAT..commit cleanout failures: block lost STAT..commit cleanouts STAT..commit cleanouts successfully completed STAT..commit immediate performed STAT..commit immediate requested STAT..consistent changes

3710976 3579904 63 62
37 1 1 1 17 16 1 1 29 36 1 1 1 18 17 1 1 29

933888 14
14 1 1 1 20 19 1 1 29

3072000 62
36 1 1 1 38 37 1 1 29

STAT..consistent gets STAT..consistent gets - examination STAT..consistent gets from cache STAT..consistent gets from cache (fastpath)
STAT..cursor authentications STAT..db block changes STAT..db block gets STAT..db block gets direct STAT..db block gets from cache STAT..db block gets from cache (fastpath) STAT..deferred (CURRENT) block cleanout applications STAT..enqueue releases STAT..enqueue requests STAT..execute count

4023 2004 4023 1817


11 135 159 7 152 34 13 67 68 485

3952 1980 3952 1782


12 136 162 7 155 36 13 66 67 468

2721 1165 2721 1446


8 151 171 7 164 40 11 59 60 368

3792 1979 3792 1583


12 248 247 7 240 57 22 76 77 465

STAT..file io wait time


STAT..free buffer requested STAT..index fetch by key STAT..index scans kdiixs1 STAT..lob reads STAT..lob writes STAT..lob writes unaligned STAT..messages sent

171607
465 566 448 47 2 2 6

147610
450 562 429 47 2 2 5

734766
126 305 349 47 2 2 6

1835882
386 562 428 47 2 2 5

STAT..no work - consistent read gets


STAT..non-idle wait count STAT..non-idle wait time

1895
234 18

1846
216 17

1461
123 75

1715
366 185

STAT..opened cursors cumulative


STAT..opened cursors current

342
2

333
2

244
1

330
2

STAT..parse count (hard) STAT..parse count (total)

37 263

38 249

28 204

37 247

STAT..parse time cpu STAT..parse time elapsed STAT..physical read IO requests STAT..physical read bytes STAT..physical read total IO requests STAT..physical read total bytes STAT..physical reads STAT..physical reads cache STAT..physical reads cache prefetch
STAT..physical write IO requests STAT..physical write bytes STAT..physical write total IO requests STAT..physical write total bytes STAT..physical writes STAT..physical writes direct STAT..physical writes non checkpoint STAT..pinned cursors current

8 4 12 12 210 194 3653632 3522560 210 194 3653632 3522560 446 430 446 430 236 236
1 57344 1 57344 7 7 7 2 1 57344 1 57344 7 7 7 2

7 10 102 876544 102 876544 107 107 5


1 57344 1 57344 7 7 7 1

6 14 340 3014656 340 3014656 368 368 28


1 57344 1 57344 7 7 7 2

STAT..recursive calls
STAT..recursive cpu usage STAT..redo entries STAT..redo size STAT..redo size for direct writes STAT..redo synch time (usec) STAT..redo synch writes STAT..rows fetched via callback

2733
25 68 16420 96 2761 2 510

2591
27 68 16408 96 1394 2 507

2148
18 79 17856 96 1491 2 278

2583
29 133 28560 96 10945 2 507

STAT..session cursor cache hits STAT..session logical reads


STAT..session pga memory STAT..session pga memory max STAT..session uga memory STAT..session uga memory max STAT..shared hash latch upgrades - no wait STAT..sorts (memory) STAT..sorts (rows) STAT..switch current to new buffer STAT..table fetch by rowid STAT..table fetch continued row

295 4182
4849664 4915200 851656 1025240 29 169 455 3 1325 33

282 4114
4849664 4915200 851656 1025240 27 159 443 3 1292 33

209 2892
5111808 5636096 851656 1090752 19 128 244 3 968 28

273 4039
5242880 5242880 917168 1025240 132 159 443 3 1294 33

STAT..table scan blocks gotten STAT..table scan rows gotten


STAT..table scans (short tables) STAT..temp space allocated (bytes) STAT..undo change vector size STAT..user I/O wait time STAT..user calls STAT..user commits STAT..workarea executions - optimal STAT..workarea memory allocated

197 54458
13 4194304 5636 18 28 2 62 122

197 54458
13 4194304 5680 17 28 2 58 104

65 10748
13 4194304 5968 75 27 2 47 157

65 10748
13 4194304 9360 184 27 2 58 117

References: http://www.scribd.com/doc/134805528/UNSELECTIVE-INDEXES

Anda mungkin juga menyukai