This project is archived and is in readonly mode.

#1852 ✓stale
Emili Parreño

Patch to add index length support

Reported by Emili Parreño | February 2nd, 2009 @ 10:55 PM | in 2.3.10

This patch add support for index length in MySQL adapter. Define a index length is a common practice for avoiding large indexes data, and improving performance.

You can now define a length for you indexes:

add_index(:accounts, :name, :name => 'by_name', :limit => 10) generates CREATE INDEX by_name ON accounts(name(10))

add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :limit => 10) generates CREATE INDEX by_name_surname ON accounts(name(10), surname(10))

add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :limit => {:name => 10, :surname => 20}) generates CREATE INDEX by_name_surname ON accounts(name(10), surname(20))

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages