mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #26642
[Bug 1450676] Re: The way we add new columns to tables can cause db to lock up
The current method programattically generates SQL statements, and then
executes them.
So the very first step on this, should be to determine exactly what SQL
statements it is generating. Then we can compare them with your raw SQL
and see why the performance is so much worse.
Cheers,
Aaron
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1450676
Title:
The way we add new columns to tables can cause db to lock up
Status in Mahara ePortfolio:
Confirmed
Bug description:
Currently when we want to add a column to an existing table we do
something like this in lib/db/upgrade.php
$table = new XMLDBTable('group');
$field = new XMLDBField('allowarchives');
$field->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $field);
The problem is if the database is big it can cause things to lock up
Changing the above to a more direct:
execute_sql('ALTER TABLE {group} ADD COLUMN allowarchives SMALLINT NOT NULL DEFAULT 0');
seems to avoid this problem.
So this bug is here so we can find out why the current way is so
resource intensive and/or what dangers there are doing it the more
direct way.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1450676/+subscriptions
References