开发者

How and when to update a MySQL index?

开发者 https://www.devze.com 2022-12-24 03:26 出处:网络
I\'m using this SQL query to create an index: $query = \"CREATE INDEX id_index2 ON countries(geoname_id, name)\";

I'm using this SQL query to create an index:

    $query = "CREATE INDEX id_index2
            ON countries(geoname_id, name)";

How do I update the index when new entries are added?

Should I run a PHP script with the update query in CRON and run it every nig开发者_开发问答ht?

Is this best practice for automated index updating?


Indexes are updated by MySQL automatically as you insert/update rows. (This may be a performance hitter for huge websites, but you probably aren't running a huge one :).) You don't need to do anything after the initial creation.


It will be automatically updated after adding rows, No need to run any update statements.

0

精彩评论

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