开发者

Dropping a SQLite database index and then adding it back on

开发者 https://www.devze.com 2023-02-14 10:29 出处:网络
I am inserting a large number of records into a SQLite database on Android. To improve insert times, I am considering creating the index on the table after dat开发者_如何学Pythona has been fully added

I am inserting a large number of records into a SQLite database on Android. To improve insert times, I am considering creating the index on the table after dat开发者_如何学Pythona has been fully added.

My question is, at what point does the database actually build the index against values on the table? Does it happen as soon as I issue the SQL statement (create index index_name on table ...), or can the database defer it until the first query arrives?

Thanks, Ranjit


It creates the index immediately you issue the create index command. The relevant code is in sqlite3CreateIndex and this will create the index and write it to disk (except for the special case where it's called as part of a database open operation but that's not the case when a user creates an index).

0

精彩评论

暂无评论...
验证码 换一张
取 消