Are Indexes
Unnecessary in
Exadata?
Arup Nanda
Longtime Oracle DBA
(and now DMA)
Disclaimer
If you downloaded this slide deck, please note:
These slides are designed merely as props to
help my presentati...
Are Indexes Unnecessary in Exadata
3
Quotes
Why? Because
there is a storage
index.
“
Drop all the
indexes and
reclaim spac...
3 Questions for “Best Practices”
Are Indexes Unnecessary in Exadata
4
1. Why it is better than the rest?
2. What happens i...
Are Indexes Unnecessary in Exadata
5
Storage
Index
Instances and Databases
6
Storage
datafile1
datafile2
SELECT NAME
FROM CUSTOMERS
WHERE STATUS ='ANGRY'
Instance
Combinatio...
Query Processing
7
Storage
datafile1
datafile2
SELECT NAME
FROM CUSTOMERS
WHERE STATUS ='ANGRY'
Database Block
JILL
Are In...
Are Indexes Unnecessary in Exadata
8
Index
Table
Components for Performance
9
CPU
Memory
Network
I/O Controller
Disk
Less I/O = better
performance
Are Indexes Unnecessary ...
The Solution
• A typical query may:
– Select 10% of the entire storage
– Use only 1% of the data it gets
• To gain perform...
11
CPU
Memory
Network
I/O Controller
Disk
iDB
Are Indexes Unnecessary in Exadata
Are Indexes Unnecessary in Exadata
12
Disk1 Disk2 Disk3
iDB
13
Disk4
MIN = 3
MAX = 5
MIN = 4
MAX = 5
MIN = 3
MAX = 5
MIN = 1
MAX = 3
Disk1 Disk2 Disk3
Storage Index
SELECT …
FROM TAB...
Storage Indexes
• Do not point to the database blocks
• Merely stores for a Storage “Unit”
– Max/Min Values
– Whether null...
Checking Storage Index Use
select name, value/1024/1024 as stat_value
from v$mystat s, v$statname n
where s.statistic# = n...
Offloading and Smart Scan
Offloading
Processing to storage cells
Smart Scan
Reduction in I/O
Are Indexes Unnecessary in Ex...
Offloading
• Column Projection
select cust_id, sale_amt
from sales
• Predicate Filtering
where status = ‘ANGRY’
• Function...
Smart Scan Benefits
• Less I/O means
– Faster disk access time
– Less data from storage to DB
– Less buffers
– Less CPU
– ...
Why Not?
• Pre-requisite for Smart Scan
– Direct Path
– Full Table or Full Index Scan
– > 0 Predicates
– Simple Comparison...
Impact of Data Distribution
Are Indexes Unnecessary in Exadata
20
Disk4
MIN = 3
MAX = 5
MIN = 4
MAX = 5
MIN = 3
MAX = 5
MI...
8 Columns
Are Indexes Unnecessary in Exadata
21
C1
C2
C3
C4
C5
C6
C7
C8
C2
C3
C4
C5
C6
C7
C8
C9
C3
C4
C5
C6
C7
C8
C9
C10
T...
No Predicate
• Aggregations
select sum(sale_amt)
from sales
• Sorting
select ...
from sales
order by sale_amt;
Are Indexes...
Function Based Indexes
• Traditional Indexes can’t work
select …
from sales
where to_char(sale_dt,’YY’) = ‘13’
• Function ...
IOTs
• Index Organized
Tables
• PK-based rows
• Secondary Indexes
built on the other
columns
Are Indexes Unnecessary in Ex...
Clustered Tables
Are Indexes Unnecessary in Exadata
25
Exclusion for SIs
• Not for non-equality
select sale_amt
from sales
where status != ‘SHIPPED’
• No Wildcards
select sale_a...
Virtual Columns
• Example
alter table EMP add (
tot_sal number(13) generated always as sal+comm)
)
• Implication
– Do not ...
Indexes on Small Tables
• Small table
– Parameter _small_table_threshold
• Indexes still help small table
http://richardfo...
Summary of SI Limitations
• Direct Path not used
• No Predicate No SI
• No Inequality (!=)
• ≤ 8 columns
• No Virtual Colu...
Flash Cache
30
Storage
datafile1
datafile2
These are flash cards
presented as disks; not
memory to the Storage Cells.
They...
Flash Trick for Indexes
• Pin Oft-Used Objects in Flash
SQL> alter index in_t2 storage (cell_flash_cache keep);
• Check fl...
Drop the Index?
• Make the indexes invisible
SQL> alter index i1 invisible;
– Maintains the index; but optimizer ignores i...
Disable
• Two parameters
– Could be session level
• To disable offloading
cell_offload_processing = false;
• To disable st...
In Conclusion
• Full table scans in Exadata
– may be faster compared to non-Exadata
– may not be faster than index scans i...
Thank You!Blog: arup.blogspot.com | Twitter: arupnanda
Are Indexes Unnecessary in Exadata
35
Upcoming SlideShare
Loading in …5
×

Are Indexes Unnecessary in Exadata

1,084 views

Published on

You heard it - drop indexes in Exadata. But should you? Learn why that is true in some cases and, more important, when it is not.

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,084
On SlideShare
0
From Embeds
0
Number of Embeds
19
Actions
Shares
0
Downloads
45
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Are Indexes Unnecessary in Exadata

  1. 1. Are Indexes Unnecessary in Exadata? Arup Nanda Longtime Oracle DBA (and now DMA)
  2. 2. Disclaimer If you downloaded this slide deck, please note: These slides are designed merely as props to help my presentation. They are not intended to stand as independent sources of information. Therefore the contents of the slide deck are not meant to be exhaustive in any way of the content delivered at the session. Are Indexes Unnecessary in Exadata 2
  3. 3. Are Indexes Unnecessary in Exadata 3 Quotes Why? Because there is a storage index. “ Drop all the indexes and reclaim space.“ ” You don’t need indexes on Exadata. “ ”
  4. 4. 3 Questions for “Best Practices” Are Indexes Unnecessary in Exadata 4 1. Why it is better than the rest? 2. What happens if it is not followed? 3. When are they not applicable?
  5. 5. Are Indexes Unnecessary in Exadata 5 Storage Index
  6. 6. Instances and Databases 6 Storage datafile1 datafile2 SELECT NAME FROM CUSTOMERS WHERE STATUS ='ANGRY' Instance Combination of •Memory Areas •Background Processes Are Indexes Unnecessary in Exadata
  7. 7. Query Processing 7 Storage datafile1 datafile2 SELECT NAME FROM CUSTOMERS WHERE STATUS ='ANGRY' Database Block JILL Are Indexes Unnecessary in Exadata
  8. 8. Are Indexes Unnecessary in Exadata 8 Index Table
  9. 9. Components for Performance 9 CPU Memory Network I/O Controller Disk Less I/O = better performance Are Indexes Unnecessary in Exadata
  10. 10. The Solution • A typical query may: – Select 10% of the entire storage – Use only 1% of the data it gets • To gain performance, the DB needs to shed weight • It has to get less from the storage  Filtering at the storage level  The storage must be cognizant of the data 10 SELECT NAME FROM CUSTOMERS WHERE STATUS ='ANGRY' CPU Memory Network I/O Controller Disk Filtering should be Applied Here Are Indexes Unnecessary in Exadata
  11. 11. 11 CPU Memory Network I/O Controller Disk iDB Are Indexes Unnecessary in Exadata
  12. 12. Are Indexes Unnecessary in Exadata 12 Disk1 Disk2 Disk3 iDB
  13. 13. 13 Disk4 MIN = 3 MAX = 5 MIN = 4 MAX = 5 MIN = 3 MAX = 5 MIN = 1 MAX = 3 Disk1 Disk2 Disk3 Storage Index SELECT … FROM TABLE WHERE COL1 = 2 Are Indexes Unnecessary in Exadata
  14. 14. Storage Indexes • Do not point to the database blocks • Merely stores for a Storage “Unit” – Max/Min Values – Whether nulls are present – For some columns • Is on Memory of Cells; not disk – Disappears when the cell is down Are Indexes Unnecessary in Exadata 14
  15. 15. Checking Storage Index Use select name, value/1024/1024 as stat_value from v$mystat s, v$statname n where s.statistic# = n.statistic# and n.name in ( 'cell physical IO bytes saved by storage index', 'cell physical IO interconnect bytes returned by smart scan’) 15 Are Indexes Unnecessary in Exadata Output STAT_NAME STAT_VALUE ---------- ---------- SI Savings 5120.45 Smart Scan 1034.00
  16. 16. Offloading and Smart Scan Offloading Processing to storage cells Smart Scan Reduction in I/O Are Indexes Unnecessary in Exadata 16
  17. 17. Offloading • Column Projection select cust_id, sale_amt from sales • Predicate Filtering where status = ‘ANGRY’ • Function Offloading select min(sale_amt) • Virtual Columns Are Indexes Unnecessary in Exadata 17
  18. 18. Smart Scan Benefits • Less I/O means – Faster disk access time – Less data from storage to DB – Less buffers – Less CPU – Less data between compute nodes Are Indexes Unnecessary in Exadata 18
  19. 19. Why Not? • Pre-requisite for Smart Scan – Direct Path – Full Table or Full Index Scan – > 0 Predicates – Simple Comparison Operators • Other Reasons – Cell is not offload capable • The diskgroup attribute cell.smart_scan_capable set to FALSE; – Not on clustered tables, IOTs, etc. 19 Are Indexes Unnecessary in Exadata
  20. 20. Impact of Data Distribution Are Indexes Unnecessary in Exadata 20 Disk4 MIN = 3 MAX = 5 MIN = 4 MAX = 5 MIN = 3 MAX = 5 MIN = 1 MAX = 2 MIN = 1 MAX = 5 MIN = 1 MAX = 5 MIN = 1 MAX = 5 MIN = 1 MAX = 5 SELECT … FROM TABLE WHERE COL1 = 2
  21. 21. 8 Columns Are Indexes Unnecessary in Exadata 21 C1 C2 C3 C4 C5 C6 C7 C8 C2 C3 C4 C5 C6 C7 C8 C9 C3 C4 C5 C6 C7 C8 C9 C10 Table T1
  22. 22. No Predicate • Aggregations select sum(sale_amt) from sales • Sorting select ... from sales order by sale_amt; Are Indexes Unnecessary in Exadata 22 Index on SALE_AMT
  23. 23. Function Based Indexes • Traditional Indexes can’t work select … from sales where to_char(sale_dt,’YY’) = ‘13’ • Function Based Indexes help • SI indexes will not be useful Are Indexes Unnecessary in Exadata 23
  24. 24. IOTs • Index Organized Tables • PK-based rows • Secondary Indexes built on the other columns Are Indexes Unnecessary in Exadata 24 PK Index Index
  25. 25. Clustered Tables Are Indexes Unnecessary in Exadata 25
  26. 26. Exclusion for SIs • Not for non-equality select sale_amt from sales where status != ‘SHIPPED’ • No Wildcards select sale_amt from sales where city like ‘NEW YORK%’ Are Indexes Unnecessary in Exadata 26
  27. 27. Virtual Columns • Example alter table EMP add ( tot_sal number(13) generated always as sal+comm) ) • Implication – Do not actually exists in the table – Computed at runtime Are Indexes Unnecessary in Exadata 27
  28. 28. Indexes on Small Tables • Small table – Parameter _small_table_threshold • Indexes still help small table http://richardfoote.wordpress.com/2009/04/16/indexes-on-small-tables- part-i-one-of-the-few/ – Less latching Are Indexes Unnecessary in Exadata 28
  29. 29. Summary of SI Limitations • Direct Path not used • No Predicate No SI • No Inequality (!=) • ≤ 8 columns • No Virtual Columns • No wildcard match (LIKE ‘..%’) • No IOT, Clustered Table • Latching on small tables • First-timer Penalty – Only subsequent queries benefit Are Indexes Unnecessary in Exadata 29
  30. 30. Flash Cache 30 Storage datafile1 datafile2 These are flash cards presented as disks; not memory to the Storage Cells. They are similar to SAN cache; but Oracle controls what goes on there and how long it stays. Are Indexes Unnecessary in Exadata alter table person storage (cell_flash_cache keep)
  31. 31. Flash Trick for Indexes • Pin Oft-Used Objects in Flash SQL> alter index in_t2 storage (cell_flash_cache keep); • Check flash CellCLI> list flashcachecontent attributes – > cachedKeepSize, cachedSize, hitCount, - > hoursToExpiration, missCount - > where objectnumber = 382380; • Or, partitions Are Indexes Unnecessary in Exadata 31
  32. 32. Drop the Index? • Make the indexes invisible SQL> alter index i1 invisible; – Maintains the index; but optimizer ignores it • See the performance impact. • Selectively see the impact SQL> alter session set optimizer_use_invisible_indexes = true; • See the performance impact. Are Indexes Unnecessary in Exadata 32
  33. 33. Disable • Two parameters – Could be session level • To disable offloading cell_offload_processing = false; • To disable storage indexes alone _kcfis_storageidx_disabled = true; Are Indexes Unnecessary in Exadata 33
  34. 34. In Conclusion • Full table scans in Exadata – may be faster compared to non-Exadata – may not be faster than index scans in Exadata – may benefit from Storage Indexes • Storage Indexes are not same as DB Indexes • No DB Indexes helps in some cases – But not all • Test by making DB Indexes invisible • Force FTS in those cases where index hurts Are Indexes Unnecessary in Exadata 34
  35. 35. Thank You!Blog: arup.blogspot.com | Twitter: arupnanda Are Indexes Unnecessary in Exadata 35

×