C
C
cccr852011-12-17 15:55:14
MySQL
cccr85, 2011-12-17 15:55:14

Find source of duplicate data in mysql?

In general, there are 2 servers, the second takes data from one, parses, and saves it to the database. We noticed that duplicate records began to appear. There can be any number of duplicates. I started to sin on the client displaying the records, I looked through the phpMyAdmin database, everything is OK (or rather not OK :)), there are really duplicates in the database. Made saving of the data which came from the first server + sql which goes to basis. Now I’m looking at the log, there are no duplicates in the incoming data, there are no duplicates in the database, there are duplicates in the database ...
I’m at a dead end, tell me at least where you can dig, what else to check.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
J
JeanLouis, 2011-12-17
@JeanLouis

Make a composite primary key so it's unique and insert records using INSERT IGNORE.

M
Max, 2011-12-17
@AloneCoder

Do you have any triggers?

X
xmeoff, 2011-12-17
@xmeoff

The solution has already been suggested above.
On my own behalf, I’ll add that in your case a composite key is not needed, one unique index is enough for the 'id' field, unless of course its name corresponds to the content).
Something like this:
ALTER TABLE progstat ADD UNIQUE INDEX (id)

N
niko83, 2011-12-18
@niko83

Can you somehow form several threads (processes)? for example, the script runs on the crown once a minute, and the script itself runs for more than one minute. or something else

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question