In my MySQL db are 2 tables: Parent
and Child
. (a field in Child
refers to the id
field in Parent
)
Sometimes I got a record in Child
deleted.
Does log-enabling (in /etc/mysql/my.cnf
) help me observe what actually causes my Child
record deleted?
One more concern:
In /etc/mysql/my.cnf
, there is this warning:
Be aware that this log type is a performance killer.
How bad could it be?
Thanks
First: As you mentioned in your question:
a field in Child refers to the id field in Parent
, this means if you delete yourparent
, the associatedchild
also gets deleted if that field is configured as foreign key.Does log-enabling (in /etc/mysql/my.cnf) help me observe what actually causes my Child record deleted?,
Yes it is possible to log your query. It's up to you however to interpret from logs what query caused the delete.
How bad could it be?
It surely decreases the performance, but it totally depends on the amount of data queried and logged and your own server/pc architecture.
There is a nice statistical blog that explains performance degrade:
You can read that blog here.