472,328 Members | 1,199 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

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 2256
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...
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...
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...
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...
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...
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,...
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...
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.