RSS
热门关键字:  数据挖掘  数据仓库  商业智能  人工智能  搜索引擎

MySQL Cluster and the Death of Secondary Indexes

来源: 作者:unkonwn 时间:2006-12-16 点击:

Relational databases use indexes to speed up their performance usually due to the fact that their underlying storage is inherently slow (which has historically meant disk). 数据挖掘研究院

I've often created secondary indexes with MyISAM which aren't used in day-to-day operation but that are needed for debugging or exploration of the database. 数据挖掘研究院

For example, if you were to have a USER table with a handle (their account name) and an ID (the primary key) you could index by the handle but usually these are long strings and take up a good amount of CPU time to build the index and memory to cache the index. 数据挖掘实验室

It dawned on me the other day that this isn't necessary with MySQL Cluster (NDB). With MyISAM you need to use an index because a full table scan might take 10-20 minutes and hold back any INSERTs in the process which could become a big problem. 数据挖掘研究院

It also has secondary problems including confusing the OS level page cache and even with INNODB will slow down the system due to the additional IO. 数据挖掘研究院

Since NDB is an all memory database no disk seeks are involved which means the entire query can happen in memory. If you have engine_condition_pushdown enabled this is even faster because you can use the CPU on all your data nodes in parallel to find the result. 数据挖掘研究院

This has two main wins for NDB. First, you can avoid the CPU costs with continually maintaining a redundant index. Second, you can save a great deal of memory and use it for storing data instead of index. This could probably give you 10-20% additional memory (and memory isn't free). 数据挖掘研究院

As a test I ran this on a table with 1M rows. I think a full table scan would have taken 1-5 minutes without an index using MyISAM. On NDB with engine_condition_pushdown this only too 1.2 seconds. Without engine_condition_pushdown it took 30 seconds since the data needed to be sent to the SQL node and computed there.

数据挖掘实验室

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
匿名?