[wp-hackers] Use of ENGINE=MEMORY w/ dbDelta() possible?

Mahmoud Al-Qudsi computerguru at neosmart.net
Sun Mar 23 17:02:24 GMT 2008


For my extension to the object-cache, I'd like to stick values in a memory-based table for optimum performance. Would this code give any problems on particular configurations?

************BEGIN CODE************
$sql="
CREATE TABLE mysql_cache (
	`key`		varchar	NOT NULL,
	`value`	VARCHAR	DEFAULT NULL,
	PRIMARY KEY(`key`)
)
ENGINE=MEMORY
PACK_KEYS=1;
";

require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
*************END CODE*************


**My Reasons**
>From the MySQL documentation:
"[Memory engine is an] Extremely fast memory-based storage engine that uses hash indices."

>From the MySQL documentation:
"[PACK_KEYS=1: ] This usually makes updates slower and reads faster."

I just want to make sure that the dbdelta() function won't give me any issues w/ this code. It won't be of any use without the ENGINE=MEMORY bit, so I might have to force it with $wpdb->query directly.

Thanks!

-Mahmoud



More information about the wp-hackers mailing list