I've a little problem;
I have 2 tables:
events
and multimedia
.
events
have the
id,
device_id
created_at field
the primary key is the id and there's a index formed by device_id
and created_at
field.
multimedia
table have the follower field:
id
device_id
created_at
data (this field is a blob field and contains a 20k string)
the primary key is id and there's a index formed by device_id
and created_by
field.
The problem is when i want to delete the record with created_at
before a data.
the query:
DELETE FROM events WHERE device_id = #{dev[0]}
AND created_at <= '#{mm_critical_time.to_s}'
is ok. In 5 or 6 second delete
the record.
The query
DELETE FROM multimedia WHERE device_id = #{dev[0]}
AND created_at <= '#{mm_critical_time.to_s}'
give me some problem, the execution start and never finish it.
what's the problem?