赫謙小便籤

Rails打索引技巧

做專案學到的一個技巧 … 應該說,是很慘痛的學到一個技巧=_= …

我們都知道,Rails可以透過rails g migration blahblah來產生Migration file然後在裡面寫add_index來打索引,可是切記切記!!不要把索引寫在同一個表內 … 當資料量大,而且其中一個index打失敗你就會哭了 …

1
Mysql2::Error: Specified key was too long; max key length is 1000 bytes: CREATE  INDEX `index_products_on_url_identify_and_name` ON `products` (`url_identify`, `name`)

慘痛T_T

Comments