是否可以向已有数据的数据库添加数据库索引? [英] Is it okay to add database indexes to a database that already has data?

查看:325
本文介绍了是否可以向已有数据的数据库添加数据库索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的生产数据库中有一些数据。如果我在几个字段上添加一些数据库索引,是否有问题?

I have some data in my production database already. If I'm adding some database indexes on a few fields, is that a problem?

Rails 2.3.5,
Ruby 1.8.7,
sqlite3数据库

Rails 2.3.5, Ruby 1.8.7, sqlite3 database

推荐答案

不,这不是问题。在我知道的索引的一些实现上,B树实际上将是数据库中的全新树(作为页),因此它不会影响新树具有分段。只是建立索引可能需要一些时间,取决于数据库中有多少数据。

No, that's not a problem. On some implementation of indexes I know of, the B-Tree actually will be brand new trees in the database (as pages), and so it won't affect the new tree to have fragmentation. Just that building the indexes may take some time depending on how much data is in the DB.

这篇关于是否可以向已有数据的数据库添加数据库索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆