** Tags added: performance

** Changed in: mahara
   Importance: Undecided => Medium

-- 
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:
  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

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to