[mythtv] RFC: Program table change timestamp

Ed W lists at wildgooses.com
Thu Apr 23 19:29:14 UTC 2009


Chase Douglas wrote:
>
> I'm not sure how updating the programs would be different than wiping
> everything and starting over. However, I've decided that the easiest
> way to do this is to delete everything from the program table that
> doesn't match any of the programs fetched from the listings provider.
> Then, delete all the programs from the listings provider data that we
> already have correct info for. Finally, insert all that is left from
> the listings provider into the program table.
>
> This is made easier by the fact that the listings data is inserted
> into the db as a temporary table. Two (possibly even one, still
> working on it) queries could do all the deletion from the program and
> the temporary listings table.


Hi, it's not 100% as efficient as a timestamp, but one way to sync is to
ask the remote server to send you the primary keys and a *hash* of each
row.  You can compute the same thing on your side and then figure out
which rows you don't have.  There are several hash functions which are
cheap to compute and mysql UDF functions can be used to speedup the
mysql side.

Have a look at maatkit for mysql to see an example of the function they
use - essentially they use the same technique for computing if two
tables match (I don't mean you to read the code, just the idea)

Good luck

Ed W


More information about the mythtv-dev mailing list