Results 1 to 2 of 2

Thread: database design problem

  1. #1
    Join Date
    Jul 2003
    Posts
    23

    Unhappy database design problem

    my database has a datetime field and data is logged into this database every 5 secs. from 9.0 am to 11.00pm. soon i realized that the datetime field is occupying much more space than the data. also when inserting a new record it is taken care that data is not unnecessarily repeated so a fequency field is added which goes on incremmenting each time a similar data record is encounterd(update previuos record's frequency instead of inserting new)
    please suggest me a suitable relational data model.

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    if it s sql server u can use smalldatetime or varchar (with UDF - date compression logic) instead of datetime. It all depends on how much you wanna trade size against accurate logging.

    Explanation
    -----------

    Values with the "datetime" data type are stored internally by Microsoft SQL Server as two 4-byte integers. The first 4 bytes store the number of days before or after the base date, January 1, 1900. The base date is the system reference date. Values for datetime earlier than January 1, 1753, are not permitted. The other 4 bytes store the time of day represented as the number of milliseconds after midnight.

    The "smalldatetime" data type stores dates and times of day with less precision than datetime. SQL Server stores smalldatetime values as two 2-byte integers. The first 2 bytes store the number of days after January 1, 1900. The other 2 bytes store the number of minutes since midnight. Dates range from January 1, 1900, through June 6, 2079, with accuracy to the minute.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •