myisam表上的外键替代? [英] Foreign key on myisam table alternative?
问题描述
我正在一个需要使用外键的网站上工作,但是我到处搜索并且共享主机不支持innoDB.我正在使用MyISAM引擎.有使用外键的替代方法吗?
I am working on a website that need to use foreign keys, but I have searched all around and shared host doesn't support innoDB. I am using MyISAM engine. Is there an alternative for using foreign keys?
我需要什么:
table_image {
image_id (PK)
}
table_ratings {
rating_id(PK)
image_id(FK)
}
谢谢.
推荐答案
在我自己幸运地切换到innoDb之前,我一直在挣扎.
I struggled the hell before I fortunately switched to innoDb myself.
我已经用一堆在线/批处理脚本实现了所有插入/删除级联逻辑...
I had implemented all the inserts/delete cascade logic with a bunch of online/batch scripts...
但是实际上可能没问题,因为在某些非常特殊的情况下,您可以断开级联操作,这对于保护性能并不总是一个坏主意.
But it might be ok actually, because in some very special situation you can disconnect cascade operations which is not always a bad idea reguarding to performances.
rgds.
这篇关于myisam表上的外键替代?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!