Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Powolne dodawanie indeksu na VARCHAR
cycofiasz
post
Post #1





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

Ostrzeżenie: (0%)
-----


Witam. Mam tabelę z użytkownikami z ponad 20 mln rekordów. Póki co był tylko jeden indeks na ID (primary key) ale postanowiłem dodać kolejny indeks na pole z nazwą użytkownika - VARCHAR (200) utf8_bin NOT NULL.

Wykonałem z konsoli
  1. ALTER TABLE xx_users ADD INDEX (u_nick);


Od ponad godziny już mieli a nawet jeszcze nie przerobiło 20% całości (sądzę po rozmiarach nowego pliku MYD).
Działam na localhoście. Win XP. Praktycznie zerowe obciążenie pamięci i procesora. Tabela MyISAM.

Czy to normalne? Czy można to jakoś znacznie przyspieszyć, jakieś limity zwiększyć na czas tej operacji?

Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
maly_swd
post
Post #2





Grupa: Zarejestrowani
Postów: 744
Pomógł: 118
Dołączył: 14.02.2009
Skąd: poziome

Ostrzeżenie: (0%)
-----


troche mozesz przyspieszyc konfiguracja, pobaw sie tym: (wartosci dodawaj swoje, to jest tylko jakis przyklad z innej strony).


#*** MyISAM Specific options

# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G

# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_sort_buffer_size=8M

# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size=262M

# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=256K

# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
sort_buffer_size=208K

Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 28.09.2025 - 00:41