PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Logiciels d'hébergement > mailing.database.mysql > slow / server crash when adding a column to a big table
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
slow / server crash when adding a column to a big table

Réponse
 
LinkBack Outils de la discussion
Vieux 30/03/2006, 02h12   #1
bennett@peacefire.org
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut slow / server crash when adding a column to a big table

I have a table with about 100,000 records whose description is:

+-----------------------+----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default |
Extra |
+-----------------------+----------------------+------+-----+---------+----------------+
| ID | int(10) unsigned | | PRI | NULL |
auto_increment |
| url | varchar(255) | YES | MUL | NULL |
|
| how_found | varchar(255) | YES | | NULL |
|
| use_for_parser | smallint(5) unsigned | YES | | 1
| |
| checked_by_parser | smallint(5) unsigned | YES | MUL | NULL
| |
| monitored | smallint(5) unsigned | YES | MUL | NULL |
|
| date_found | datetime | YES | | NULL |
|
+-----------------------+----------------------+------+-----+---------+----------------+

I tried adding a column with the command:
alter table url add column use_for_aol_mail smallint unsigned default 1
after checked_by_parser;

This caused the command prompt to hang and apparently crashed the Web
server which then had to be rebooted. Is there anything special to
keep in mind about adding columns to such a large table?

  Réponse avec citation
Vieux 30/03/2006, 02h38   #2
Bill Karwin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: slow / server crash when adding a column to a big table

bennett@peacefire.org wrote:
> alter table url add column use_for_aol_mail smallint unsigned default 1
> after checked_by_parser;
>
> This caused the command prompt to hang and apparently crashed the Web
> server which then had to be rebooted. Is there anything special to
> keep in mind about adding columns to such a large table?


Any ALTER TABLE statement causes MySQL to "rebuild" the table. That is,
it creates a new table according to the schema changes you specified,
copies all data to a new table, then removes the old version of the table.

This can take a while if the table is populated with many rows, and it
requires additional disk space temporarily. It could also cause a lot
of resource usage (I/O, CPU, memory) that competes with the activity of
other services.

I would expect it to cause some slowness on the system, but I'd be
surprised if it caused a crash of any kind, unless your server is
severely undersized.

Regards,
Bill K.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h48.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07275 seconds with 10 queries