I have a table with lots of param columns, and a count
column. Records can have duplicates on all columns excluding count
, so now DB gets lots of unnecessary records.
The idea is:
1) make id
column binary and with each insert set it to md5(param1 . param2...)
2) if the insert action gets "ON DUPLICATE KEY" (which is md5 of params) -> do not insert new, and UPDATE existing record via count
= count
+ $count.
finnally, i think, SQL query will look like this
INSERT INTO log_urls (id, server, channel, userCount) VALUES (3cb27ceaa9ea4649d661090de5d47043, 'www.server.net', 10, 1900) ON DUPLICATE KEY UPDATE userCount=userCount + 1900;
So, how can i make doctrine understand binary id
column??