I have some comments to add: specifically, about using the database date/time format/type.

If you are going to do any sort of transformation/computation of date/time within perl, I recommend storing the data as an integer ( seconds since epoch time ) in order to reduce overhead.

You may argue that you can do this transformation in the SQL statements, but it's still a huge performance hit ( as far as I could tell ) when you are dealing with tens and hudreds of thousands of record which each needs to have the epoch time format in order to do some calculations

In my case, I needed to fit a certain API that expected epoch time to do its processing. I tried it with a) store date/time in db format, covert upon fetch b) sotre data/time in db format, convert from within SELECT statement c) store data/time as seconds since epoch time, no conversion

This yielded in roughly a) and b) taking the same amount of time, where as c) took about half of the time that it took for a) and b).

So, depending on your application, I strongly urge you to use epoch time instead of native date/time format


In reply to Re: Re: Totaling Time by lestrrat
in thread Totaling Time by nlafferty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.