Tema: mysql cache
Pogledajte određenu poruku
Staro 11. 01. 2006.   #12
Petar Marić
Python Ambassador
Master
 
Avatar Petar Marić
 
Datum učlanjenja: 06.06.2005
Lokacija: Novi Sad
Poruke: 602
Hvala: 28
27 "Hvala" u 17 poruka
Petar Marić će postati "faca" uskoro
Pošaljite ICQ poruku za Petar Marić
Lightbulb

Hm, mislim da HEAP (aka MEMORY) tabele nisu najefikasnije rešenje za keš, osim ako ne želiš da izgubiš sav sadržaj keša pri restartovanju servera

Citat:
14.3. The MEMORY (HEAP) Storage Engine
The MEMORY storage engine creates tables with contents that are stored in memory. Before MySQL 4.1, MEMORY tables are called HEAP tables. As of 4.1, MEMORY is the preferred term, and HEAP is a synonym for MEMORY.

Each MEMORY table is associated with one disk file. The filename begins with the table name and has an extension of .frm to indicate that it stores the table definition.

To specify explicitly that you want a MEMORY table, indicate that with an ENGINE or TYPE table option:

CREATE TABLE t (i INT) ENGINE = MEMORY;
CREATE TABLE t (i INT) TYPE = HEAP;


MEMORY tables are stored in memory and use hash indexes by default. This makes them very fast, and very useful for creating temporary tables. However, when the server shuts down, all data stored in MEMORY tables is lost. The tables continue to exist because their definitions are stored in the .frm files on disk, but their contents are empty when the server restarts.

...
Ako pročitate celokupnu stranicu možete zaključiti sledeće o HEAP/MEMORY tabelama:
Pros:
1. Brže su

Cons:
1. Zahtevaju dodatni RAM
2. Celokupne se moraju nalaziti u RAM-u
3. Pri restartovanju servera gube se podaci sadržani u njima (definicije same tabele ostaju)
4. Mogući sinhronizacioni problemi ako koristimo replikaciju
5. Ne podržavaju BLOB i TEXT polja (kao i njihove varijante, duh)
6. Polja tabele su fiksne dužine

Eto, sad je samo ostalo da se dodaju korektivni faktori za svaku stavku i da donesemo odluku (narodski rečeno: da izvagamo rešenje)
__________________
Python Ambassador of Serbia

Poslednja izmena od Petar Marić : 11. 01. 2006. u 23:02.
Petar Marić je offline   Odgovorite uz citat