22.214.171.124 Adapting DML Statements to memcached Operations
Benchmarks suggest that the
daemon_memcached plugin speeds up DML operations (inserts, updates, and deletes) more than it speeds up queries. Therefore, consider focussing initial development efforts on write-intensive applications that are I/O-bound, and look for opportunities to use MySQL with the
daemon_memcached plugin for new write-intensive applications.
Single-row DML statements are the easiest types of statements to turn into
delete. These operations are guaranteed to only affect one row when issued through the memcached interface, because the
key is unique within the table.
In the following SQL examples,
t1 refers to the table used for memcached operations, based on the configuration in the
key refers to the column listed under
val refers to the column listed under
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;
TRUNCATE TABLE and
DELETE statements, which remove all rows from the table, correspond to the
flush_all operation, where
t1 is configured as the table for memcached operations, as in the previous example.
TRUNCATE TABLE t1; DELETE FROM t1;