[Tfug] Representing Periods of Time In MySQL?

Jim Secan jim at nwra.com
Mon Jan 14 15:23:19 MST 2008


It would depend on how you use these.  Do you care anything at all about
the times themselves, or only on the length of the interval?  In that case,
just keep the interval.  If you do care about the times, the only other
alternative I can think of is the start time and length of interval.  Do
you use database manipulation on the end time, or on the length of the
interval?  You would want to store the one you use in manipulating
(sorting, extracting, etc) the database rather than have to calculate it
each time.  I've known people to store redundant information (in this case
both the end time and the length of the interval) to reduce database access
time at the cost of extra storage.  This is definitely a YMMV situation.

Is this even close to what you're asking?

Jim

At 03:15 PM 1/14/2008 -0700, you wrote:
>I've been doing some database work for awhile now,
>but I always wondered - is there any "good" or "best" way
>to represent periods of time in MySQL?
>
>I've used a start time (TIME) and an end time (TIME) to do
>so, but I'm beginning to wonder if there's an easier and better
>way?
>
>Thoughts/input are greatly appreciated...
>
>    - Chris
>
>-- 
>Chris Robbins
>Systems Programmer
>Department of English - University of Arizona
>http://www.homerengineeringcorp.net
>_______________________________________________
>Tucson Free Unix Group - tfug at tfug.org
>Subscription Options:
>http://www.tfug.org/mailman/listinfo/tfug_tfug.org
>
>
*---------------------*-------------------------------*
| Jim Secan           | Northwest Research Assoc, Inc |
| (jim at nwra.com)      | 2455 E. Speedway, Suite 204   |
| (520) 319-7773      | Tucson, Arizona 85719         |
*---------------------*-------------------------------*





More information about the tfug mailing list