I have a table that is close to 20million records and growing. The table was setup as innodb. There is a primary index on the two main fields:
`entries_to_fields`
entry_id int(11) NO PRI NULL
field_id int(11) NO PRI NULL
value text NO NULL
Despite the number of records, most of the queries to this table are exceptionally quick, except for the following:
DELETE FROM `entries_to_fields` WHERE `entry_id` IN (SELECT `id` FROM `entries` WHERE `form_id` = 196)
This deletes all entry data for a specific form.
Currently this is taking over 45 seconds, even if the entries table returns no results.
My question is can is there a simple change to the entries_to_fields
structure I can make, or can I optomise my query further.