[mythtv] findid for non-find rules, IsSameProgram checks (help Bruce!)

David Engel david at istwok.net
Sat Aug 4 17:06:36 UTC 2007

On Thu, Aug 02, 2007 at 09:18:06PM -0500, David Shay wrote:
> OK.  I'll remove it in my update.  I still wonder if the check above
> that ought to be even more qualified by the specific findtypes and
> override types.  It looks like IsSameProgram is most often called by
> the scheduler, which defaults in a 0 for findid for those types, but
> that is not always true for other cases where it can also be called
> from.

There might be a very subtle bug when overrides are used with find
rules.  I don't remember for sure from my earlier testing since it's
been a while.  Otherwise, the check should be sufficient for all other
cases since findid is not set for rules where it doesn't apply.  If it
is, it's a bug and please let me know.

On Thu, Aug 02, 2007 at 09:14:27PM -0500, David Shay wrote:
> No, I wasn't sure about it.  That was the next case, which, following
> every normal 80-20 rule, will take the next 80% of the work, since you
> are correct, IsSameProgram only solves half the battle.  It's pretty
> obvious why, now that I look at it, since I think the query just
> matches on programid automatically.  Oh well, I thought going into
> this that I'd have to do something to that query....

There's a potential scheduler optimization I've been wanting to try.
It might prove useful for your task.

Currently, the scheduler checks duplicates for all matching programs
in a single query.  That means the join conditions for oldrecorded and
recorded have to account for all of the supported duplicate check
methods.  MySQL is not efficient with those joins, particularly the
oldrecorded one, and causes them to be the biggest factor in how long
the scheduler query takes.

What I'd like to try is have the scheduler run a separate query for
each recordid with matching programs.  The join conditions could then
be tailored for each recordid and, in theory, be simpler and more
efficient.  For example, single, override and no duplicate rules wouldn't
need any duplicate checking at all.  Manual rules would only need to
check the subtitle (where the date and time is place).  If programids
are available, most other rules could get by only checking those.

Running multiple queries would certainly add some overhead, but it
just might be offset by the efficiency of running more targeted duplicate

David Engel
david at istwok.net

More information about the mythtv-dev mailing list