Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8316153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:17:45+00:00 2026-06-08T21:17:45+00:00

I searched Google for a question I ask myself since this morning but couldn’t

  • 0

I searched Google for a question I ask myself since this morning but couldn’t find any information or article about it.

I was wondering, in the following situation, to improve performance (a little % still) :

Context: I have two column : ID, AddedAt (AddedAt is the Unix Timestamp of when the row is created).

Theoretically, if you insert a new row, ID will be +1 and AddedAt will be the current time.

Now, let’s say it is impossible in the current situation to have two simultaneous insert, would it be better to use AddedAt as a PK and remove the ID column ? AddedAt will be only one and unique column that does PK and UNIX Timestamp. So in the final, I will have one column instead of two.

The only bad side I see is maybe the size of the key that will be created on AddedAt since unix timestamp now’s day is 10 digits.

Would it be better, in this situation ? What’s your opinion ?

EDIT: What about using timestamp + ms ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:17:46+00:00Added an answer on June 8, 2026 at 9:17 pm

    Timestamps are in seconds. While you might not have simultaneous inserts, as the world tends to speed up you might get multiple inserts in a second. Build your system to function soundly–don’t use timesamps as primary keys.

    Also, with statement replication sometime timestamps arent consistent across dbs… Row based replication alleviates this, but still its another reason for concern when using them.

    From an good convention standpoint, Primary Keys should have some clear meaning to others outside yourself if it’s anything other than just us a plain old auto incrementing id field. Generally, people expect numbers or char values for keys, not things like blobs, timestamps, datetimes, etc… This is especially true if later it’s used for as a foreign key in another table, using timestamp as a foreign key can be confusing to later developers. Sure, if you have a varchar GUID field you know is unique, use it as the key. Just remember when used as a foreign key your going to eat up also quite a bit of memory if you have a huge string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I searched google but couldn't find an answer to this rather simple question. I
I've searched (google and SO) about this topic and couldn't find a thorough answer
this question may have been asked many times, but could not find any suitable
I've searched Google and this website many times, but can not find a solution
I have searched Google and Stackoverflow for this question, but I still don't understand
This may be a stupid question but however I searched in google with jquery
I've searched google and SO for a solution to this problem but have not
I have searched around Google and StackOverflow trying to find a solution to this,
I have searched google but could not find an answer to what I think
I've searched Google about this specific exception and multiple results have surfaced but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.