Well… there’s:
- database
- table name
(both of these are quite obvious).
But then you have:
- temporary tables
Well… two types of temporary tables:
- those created in the course of query execution, typically in /tmp/
- those created during ALTER TABLE, typically in the database directory
You may have seen these “#sql-foo.frm” etc files around.
but you can also CREATE TABLE `#sql-foo` (you know, because that’s a good string to use in your app). In fact, you can (and shouldn’t) create a table with the exact same name as the temporary #sql table and use it in your app.
So really the primary key for a table is: string database name, string table name, bool is_tmp. Oh, and the /tmp/ temporary tables just to screw with your braiiiinn.
In drizzle, this is what the storage engine API is …
[Read more]