[mythtv] record databas question

Matt Zimmerman mdz at debian.org
Thu Jun 12 15:15:09 EDT 2003


On Wed, Jun 11, 2003 at 07:54:01PM -0700, Chris Petersen wrote:

> nevermind.  I spoke before looking at the database.  thought that "time"
> were timestamps, not "time" fields.
> 
> though this does beg the question - why the inconsistency?  timestamps are
> a heck of a lot smaller and easier for the database to search through -
> and seem to be used more often throughout the rest of myth.

The primary reason that TIMESTAMP is used instead of datetime is for
compactness.  TIMESTAMP is used for the program start and end times, and
then for any fields which correspond directly to those.  Since all of these
fields are compared for equality, there may 

The record table uses DATE and TIME because they fit the data.  Those
records don't necessarily even have a DATE, so that column can be NULL.
There may also be more complex specifications in the future, such as a
record which only matches a specific day of the week.

6 bytes vs. 4 bytes is not a heck of a lot smaller, especially considering
that this is a table which has less than 100 rows.

If you're going to make claims about what is easier for the database, I
recommend that you back them up with measurements based on the operations
that mythtv actually performs.  Comparing TIMESTAMPs to other TIMESTAMPs is
very fast, of course, but that isn't what mythtv does in this case.  And
besides, we're talking about an operation which takes place a few times per
_day_ here.

-- 
 - mdz


More information about the mythtv-dev mailing list