I’m altering the all table's names, which takes a long time to finish. But now, I use ‘PRAGMA writable_schema=ON’ to alter them, which is written athttps://www.sqlite.org/lang_altertable.html Although it is easy to corrupt the database, but I do it careful enough, and testing adequate, it should be no problem
原始邮件 发件人:Simon slavinslav...@bigfraud.org 收件人:SQLite mailing listsqlite-us...@mailinglists.sqlite.org 发送时间:2016年10月10日(周一) 17:03 主题:Re: [sqlite] CREATE TABLE/ALTER TABLE Slow Down When Table CountGrow On 10 Oct 2016, at 4:52am, sanhua.zh sanhua...@foxmail.com wrote: I foundCREATE TABLE/ALTER TABLE Slow Down When Table Count Grow. Yes. SQLite needs to search through the (hashed) list of tables every time you give it a command that uses tables. The more tables there are, the longer it has to search -- each time it gets a command. The more tables there are, the more indexes there are, and the longer SQLite has to spend searching through the indexes too. The more tables there are, the more space is wasted on space allocated to each of these tables and indexes which goes unused. Are you creating new tables inside your application ? Do these new tables have the same columns as one-another (or nearly the same columns) ? If so, then it is far more efficient to create one table with one extra column for what used to be the tablename. SQLite can easily handle a table with billions of rows and it will far faster to do that than searching through ten thousand tables. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users