473,467 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

best type for unix file system timestamp?

So, I'm recording the timestamp from some unix files.

Any opinions as to whether it's best to use a "bigint"
(which matches the file system data) or a "timestamp"
(which might be easier to manipulate in the database)?

TIA!
Mark

--
Mark Harrison
Pixar Animation Studios

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #1
4 2341
However it may be represented, it IS a timestamp, so why not use a timestamp
data type if you have one available to you? That's what data types are for
after all...
So, I'm recording the timestamp from some unix files.

Any opinions as to whether it's best to use a "bigint"
(which matches the file system data) or a "timestamp"
(which might be easier to manipulate in the database)?

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #2
Mark Harrison <mh@pixar.com> wrote:

So, I'm recording the timestamp from some unix files.

Any opinions as to whether it's best to use a "bigint"
(which matches the file system data) or a "timestamp"
(which might be easier to manipulate in the database)?


I tend to choose datatypes that lend themselves to easily and clearly
viewing and manipulating the data with the command-line utility, unless
there's a very good reason to do otherwise.

PostgreSQL has a rich complement of operators and functions for working
with timestamp values, so I'd tend to stick with that, I think.

Jim

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3
Exactly, with using 'timestamp' you gain data integrity as the database
will make sure that it only accepts valid timestamps. So, if your code
that you use to INSERT gets skewed someway, it will fail if you try to
insert an invalid number.

-Robby
On Fri, 2004-07-30 at 14:26, Glen Parker wrote:
However it may be represented, it IS a timestamp, so why not use a timestamp
data type if you have one available to you? That's what data types are for
after all...
So, I'm recording the timestamp from some unix files.

Any opinions as to whether it's best to use a "bigint"
(which matches the file system data) or a "timestamp"
(which might be easier to manipulate in the database)?

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

--
Robby Russell | Owner.Developer.Geek
PLANET ARGON | www.planetargon.com
Portland, OR | ro***@planetargon.com
503.351.4730 | blog.planetargon.com

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #4
Also, there is the ability to write code that behaves a certain way
based on the data type.

For example, say you have a PHP script and you want all dates that
display on the page to be displayed with January 1, 2004, you could
program your code in a fashion that would do this should a datatype
'timestamp' be determined as the data type. This comes in handy when you
build generic things like reporting engines that you don't necessarily
know what data is coming to you, but know the data types.

-Robby

On Fri, 2004-07-30 at 16:52, Robby Russell wrote:
Exactly, with using 'timestamp' you gain data integrity as the database
will make sure that it only accepts valid timestamps. So, if your code
that you use to INSERT gets skewed someway, it will fail if you try to
insert an invalid number.

-Robby
On Fri, 2004-07-30 at 14:26, Glen Parker wrote:
However it may be represented, it IS a timestamp, so why not use a timestamp
data type if you have one available to you? That's what data types are for
after all...
So, I'm recording the timestamp from some unix files.

Any opinions as to whether it's best to use a "bigint"
(which matches the file system data) or a "timestamp"
(which might be easier to manipulate in the database)?

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

--
Robby Russell | Owner.Developer.Geek
PLANET ARGON | www.planetargon.com
Portland, OR | ro***@planetargon.com
503.351.4730 | blog.planetargon.com

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: kingofkolt | last post by:
All, What do you recommend as the best type of field for a timestamp in a MySQL database? I've considered varchar(10) or INT but I'm not sure what is the best, most efficient, and most reliable...
1
by: maxim vexler | last post by:
in a book i am ready now : O'Reilly - Web Database Application with PHP and MySQL, 2nd ed. by David Lane, Hugh E. Williams on chapter 9 the author give an example for age validation :...
3
by: dgaucher | last post by:
Hi, I want to consume a Web Service that returns a choice, but my C++ client always receives the same returned type. On the other hand, when I am using a Java client, it is working fine (of...
0
by: Casey | last post by:
Hi! I found several resources describing how to convert the UNIX timestamp to a readable date, however I need to convert a date into a UNIX timestamp. For instance, I'm writing a program that will...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
2
by: John Reese | last post by:
Hi. >>> import time, calendar, datetime >>> n= 1133893540.874922 >>> datetime.datetime.fromtimestamp(n) datetime.datetime(2005, 12, 6, 10, 25, 40, 874922) >>> lt= _ >>>...
2
by: anwar | last post by:
Hi all, Im trying to extract db2 server current system timestamp from unix shell script. So from shell script call the export command " db2 export to curdate.txt of del modified by chardel' '...
6
by: marc | last post by:
hi im trying to convert Date() into a unix timestamp so i can stick the result into a mysql db, please help!
2
by: mike.lussier | last post by:
I have written some simple XSL pages to extract the data I need but each device here has a total of 6 keys and within this 6 values a time stamp and how long until the next data extraction ( 300...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.