This project is archived and is in readonly mode.

#4176 new
Sai Emrys

Make change_table execute changes in batch

Reported by Sai Emrys | March 14th, 2010 @ 06:49 PM

Currently, change_table executes every change as an ALTER TABLE in sequence.

This is extremely inefficient if making multiple changes, especially for a large table. (E.g. right now I'm adding ~25 columns to a table with ~1M rows.) Instead of just e.g. reallocating the table space for the full new size, it reallocates it for every single increment. That's lame.

Instead, change_table should batch together the operations requested (if compatible) and execute them as a single ALTER TABLE command, which would allow the database to optimize its operation.

cf. http://dev.mysql.com/doc/refman/5.1/en/alter-table.html for the mysql version; this is probably true of all other vendors also.

Thanks!

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>

People watching this ticket

Pages