Adapting DML Statements to memcached Operations
Benchmarks suggest that the InnoDB memcached plugin speeds up DML operations (inserts, updates,
and deletes) more than it speeds up queries. You might focus your initial development efforts on writeintensive
applications that are I/O-bound, and look for opportunities to use MySQL for new kinds of
write-intensive applications.
• INSERT INTO t1 (key,val) VALUES (some_key,some_value);
SELECT val FROM t1 WHERE key = some_key;
UPDATE t1 SET val = new_value WHERE key = some_key;
UPDATE t1 SET val = val + x WHERE key = some_key;
DELETE FROM t1 WHERE key = some_key;
Single-row DML statements are the most straightforward kinds of statements to turn into memcached
operations: INSERT becomes add, UPDATE becomes set, incr or decr, and DELETE becomes
delete. When issued through the memcached interface, these operations are guaranteed to affect
only 1 row because key is unique within the table.
In the preceding SQL examples, t1 refers to the table currently being used by the InnoDB
memcached plugin based on the configuration settings in the innodb_memcache.containers
table, key refers to the column listed under key_columns, and val refers to the column listed
under value_columns.
• TRUNCATE TABLE t1;
DELETE FROM t1;
Corresponds to the flush_all operation, when t1 is configured as the table for memcached
operations as in the previous step. Removes all the rows in the table.
... zobacz całą notatkę
Komentarze użytkowników (0)