almost 4 years ago

新增index就是新增索引,讓sql在找資料的時候可以根據索引找得更快,不用真的把所有資料都跑完

該作用的時機:

  1. Always add index for foreign key http://rails-bestpractices.com/posts/21-always-add-db-index
  2. 進階做法 https://tomafro.net/2009/08/using-indexes-in-rails-choosing-additional-indexes

參考資料:
http://rails-bestpractices.com/posts/21-always-add-db-index
https://tomafro.net/2009/08/using-indexes-in-rails-index-your-associations

← Understand Rails Authenticity Token 運用Rails Layout 與 Class繼承 實作Admin後台 →
 
comments powered by Disqus