There is a table of calls. When adding data, you need to compare so that there are no duplicates. Comparison of only by the time allowed to start a call using the Unique field and INSERT IGNORE impossible. there is a possibility of a call from different numbers at one time, i.e. one call to the database will not get that bad. I tried to add another unique method to the number from which the call was being made following the logic that at one point in time there could not be 2 calls from one number. But in general, it was recorded at least 30% less records. hike this approach is also not working. Can someone tell me how to put in the database values ​​for 2 fields. enter image description here

  • Have you tried to do a composite unique index of two fields at the same time? Inquire what unique indexes you tried to create in the form of create index commands. Although something tells me that you need to do this with a trigger and it’s about time to round it up. otherwise, with a difference of 1 second, uniqueness will not help - Mike
  • need uniqueness - add a unique index for two fields. And since the description of the problem is not clear what is happening there at all, I personally did not understand - teran
  • Before deleting duplicates, decide what exactly should be considered a duplicate in your subject area. I have little knowledge of telephony, and therefore I can imagine several parallel conversations with the same number, both incoming and outgoing, I can quite well - there are multi-channel numbers. - Shallow
  • Here is a table with 2 unique keys (id itself I do it in return there). And I tried the INSERT IGNOR INTO - ASYOU team
  • 2
    If we are talking about billing (or another serious system), then only a complete duplicate should be considered a duplicate - i.e. equality across ALL fields of record. If the decision is made to determine the uniqueness only in part of the fields, you must first clearly and unambiguously formulate a criterion which of the two semi-duplicate records should be deleted and which one should be left. To ensure that the same record was removed from the pair, regardless of what, when and who implements it programmatically. While there is no such criterion, it does not make sense to think “as”. - Akina

0