MySQL 'UPDATE ON DUPLICATE KEY' without a unique column?

后端 未结 3 1463
逝去的感伤
逝去的感伤 2021-01-12 10:31

What are peoples\' thoughts on the most performance efficient way to do the following query:

  • 3 column table

  • if the combination of col_

3条回答
  •  青春惊慌失措
    2021-01-12 11:14

    Edit: Ignore my suggestions

    You can use a composite key as ceejayoz said, however I think you need REPLACE INTO instead of UPDATE ON DUPLICATE KEY because REPLACE also inserts if no duplicate is found.

    Note: I don't know the workings of UPDATE ON DUPLICATE KEY but it sounds like it doesn't perform inserts.

提交回复
热议问题