Image

Imagemonotonehell wrote in Imagephp

Php + mysql: Query conundrum.

This is pretty much a general database question, but tangentially connected to php as that's the mechanism I'm using.

I have a number of user's PCs hitting a server (around 200) several times a day each. They are sending telemetry to a central MySql database. One particular value changes only occasionally, but is reported upon each contact, and needs to be updated when it changes.

The question is; is it best to query the DB, compare if the value has changed, then update the record. Or; would it be better to just update the record on each hit regardless of its state?

(Question framed in the point of view of efficiency as well as overheads created from constantly rewriting records.)