![]() | |
#11
| |||
| |||
|
|
Assume I have 930 milliom records. Doing a binary search takes 30 disk-reads, which I think, are too slow. 1. Is MySQL index a B-tree ? 2. Can I create an auxilliary index table (ie index of index) to speed up the search ? Thanks for advice. 30 disk reads for 930 million rows seems to be pretty good to me. *If it's too slow for you, you need to optimize your disk hardware. -- |
#12
| |||
| |||
|
|
Assume that I create a file like the following: File1 ==== Block1 - max key in block 1 (say 1000 records) Block2 - max key in block 2 (as above) ... ... Block10 - max key in block 10 (as above) 1. File1 contains the largest key in an index file for each block (say a block contains 1000 records). 2. Given a key, I search File1 to determine which block does it reside. 3. I then retrieve that block of index file to search the exact key I need (using binary search). 4. The assumption is, if the index is divided into 10 blcok, I can narrow down to 10% by search File1. Please comment. |
#13
| |||
| |||
|
|
Assume I have 930 milliom records. Doing a binary search takes 30 disk-reads, which I think, are too slow. 1. Is MySQL index a B-tree ? 2. Can I create an auxilliary index table (ie index of index) to speed up the search ? Thanks for advice. 30 disk reads for 930 million rows seems to be pretty good to me. If it's too slow for you, you need to optimize your disk hardware. -- Assume that I create a file like the following: File1 ==== Block1 - max key in block 1 (say 1000 records) Block2 - max key in block 2 (as above) ... ... Block10 - max key in block 10 (as above) 1. File1 contains the largest key in an index file for each block (say a block contains 1000 records). 2. Given a key, I search File1 to determine which block does it reside. 3. I then retrieve that block of index file to search the exact key I need (using binary search). 4. The assumption is, if the index is divided into 10 blcok, I can narrow down to 10% by search File1. Please comment. |
#14
| |||
| |||
|
|
Assume I have 930 milliom records. Doing a binary search takes 30 disk-reads, which I think, are too slow. 1. Is MySQL index a B-tree ? 2. Can I create an auxilliary index table (ie index of index) to speed up the search ? |
#15
| |||
| |||
|
|
sl@my-rialto wrote: Assume I have 930 milliom records. Doing a binary search takes 30 disk-reads, which I think, are too slow. 1. Is MySQL index a B-tree ? 2. Can I create an auxilliary index table (ie index of index) to speed up the search ? Thanks for advice. 30 disk reads for 930 million rows seems to be pretty good to me. If it's too slow for you, you need to optimize your disk hardware. |
#16
| |||
| |||
|
|
Assume I have 930 milliom records. Doing a binary search takes 30 disk-reads, which I think, are too slow. 1. Is MySQL index a B-tree ? 2. Can I create an auxilliary index table (ie index of index) to speed up the search ? For a B+ tree, a program will read (ie disk -read) a block at a time. A B+ tree of order 1000 will have 3 levels to index 930 million records, 1000^n = 930 000 000, *where n = 3 levels. Thus given a key, it takes 3 disk-reads; after a disk-read, a binary search can be performed (the time for a search in RAM is negligible compared to a disk-read). For a non-B+ tree index, how does it operate in MySQL ? Thanks. |
![]() |
| Thread Tools | |
| Display Modes | |
| |