Re: 500 mil. rows table partitioning
> I don't quite understand about 'value'. Since it is not in WHERE does it have to be it in index?
Let me provide a simplified example to answer your question.
INDEX(a)
SELECT b FROM tbl WHERE a=123;
The select will execute thus:
1. drill down the BTree index on `a`.
2. Reach over into the "data" to find the row, so it can fetch the value of `b`.
This is slightly different, and more efficient:
INDEX(a,b)
SELECT b FROM tbl WHERE a=123;
The select will execute thus:
1. drill down the BTree index on (a,b), using only the `a` part. Viola! The value of b is sitting right there in the index. No need to reach into the data.
The EXPLAIN plan indicates the latter case by saying "Using index".
Imagine a directory of people, and information about them. The directory has the people in no particular order, but there is an 'index' of names plus page numbers.
Case 1: index contains only last names.
1. flip through the index, looking for Krassovski. The index says "see page 432.
2. Go to page 432 to find the firstname Misha.
Case 2: index contains lastname and firstname.
1. flip through for Krassovski; "Misha" will be right there; no need to go to page 432.
However, if you wanted more than the firstname, you would still have to go to page 432.
Because your table is "Huge", I included this obscure optimization.
Subject
Views
Written By
Posted
3621
June 27, 2011 09:15AM
2162
July 01, 2011 06:22PM
1990
July 13, 2011 02:43PM
1835
July 14, 2011 12:51AM
1926
July 15, 2011 12:42PM
1850
July 15, 2011 07:59PM
1816
July 21, 2011 09:40AM
1963
July 21, 2011 08:46PM
2050
July 27, 2011 06:27AM
Re: 500 mil. rows table partitioning
1784
July 30, 2011 06:14PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.