oracle - Is an Index Organized Table appropriate here? -
I was recently reading about Oracle Index Organized Tables (IOT), but I'm not sure they used When I am quite understandable. So I have a small table:
create table categories (ID VARCHAR2 (36), group VARCHAR2 (100), category VARCHAR2 (100) create unique index (group, category, id) COMPRESS 2;
ID
column is a foreign key entries
from another table and my usual query is:
e.id, e.time, from e.title entries, categories C where e.id = c.id and for example =? And c.category =? E.time ORDER by code> The table is properly indexed.
There are millions of rows in this table (currently 16 m) and the query is currently really smelling (note: I put it on a single page to query I have only wrapped 20 already, but I have been given up for simplicity).
Since I basically index entire table, does this table IOT
Edit : Create table entries (ID VARCHAR2 (36), TIMESTEMP time by popular demand , Group VARCHAR2 (100), title VARCHAR2 (500), ....) Create index (group, time) sec 1;
My actual question I do not think depends on it though. In fact if you have a table with some columns (3 in this example) and you are planning to put a composite index on all three lines, then what is the reason for not using IOT? IOTs are great for many purposes, in this case, where you have all the columns (or most of them) in the column.
On any indicator - but the benefit is only if you do not additional index - the idea that the table is automatically an index, so put the column in that order so that you want to put the index inside. In your case, you are reaching the category based on the ID, so it makes sense for the first column. So effectively you got an index on (id, group, category). I do not know why you want an additional index on (group, category, id).
Your query:
SELECT e.id, e.time, entries from e.title e, categories C WHERE e.id = c.id and for example =? And c.category =? E. Order by Time
You are joining tables from IDs, but you do not have any indices on entries.id - so the query is probably joining a hash or sort merge
If you want to score points on a page (only interested in a small number of rows), then you want to get first the rows as soon as possible; To do this, you probably need a nested loop on entries, such as:
Entrance table to be entered by Roaded - Indication index range scan - (ENTRIES.group, Time Index) Access Table ROWID BY - CATEGORIES INDEX RANGE SCAN - (Index on CATEGORIES.ID)
Since ID is included in CATEGORIES, you need an index on ID; If you make it an IOT, and make the leading column ID, then it can be enough.
The performance of the plan shown above depends on how many rows match the given "group" - that is how an average "group" is selected.
Comments
Post a Comment