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

  • Home
  • SEARCH
  • 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 8151647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:27:12+00:00 2026-06-06T15:27:12+00:00

I have a table in which a column stores image src which is in

  • 0

I have a table in which a column stores image src which is in hash value and that hash value is generated from microtime(),Now I have two choice storing directly hash value in database or storing that bigint microtime from which the image name is derived.Which would make my db faster.

  • 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-06T15:27:14+00:00Added an answer on June 6, 2026 at 3:27 pm

    We have to analyze this from all sides to asses what speed faults are incured.

    I will make a few assumptions:

    • this data will be used as an identifier (primary key, unique key, composite key);
    • this data is used for searches and joins;
    • you are using a hashing algorithm such as SHA1 that yields a 40 character string of hex encoded data (MD5 yields a 32 character string of hex encoded data all said bellow can be adapted to MD5 if that’s what you’re using);
    • you may be interested in converting the hex values of the hash into binary to reduce the storage required by half and to improve comparison speed;

    Inserting and Updating on the application side:

    As @Namphibian stated is composed of 2 operations for the BIGINT versus 3 operations for the CHAR.

    But the speed difference in my opinion really isn’t that big. You can run 10.000.000 continuous calculations (in a while loop) and benchmark them to find out the real difference between them.

    Also a speed difference in the application code affects users linearly, while speed differences in the DB affect users nonlinearly when traffic increases because overlapping writes have to wait for each other and some reads have to wait for writes to finish.

    Inserting and Updating on the DB side:

    Is almost the same for a BIGINT as it is for a CHAR(40) or a BINARY(20) because the more serious time consumption is done waiting for access to the disk rather than actually writing to it.

    Selecting and Joining on the DB side:

    This is always faster for a BIGINT compared to a CHAR(40) or a BINARY(20) for two reasons:

    • BIGINT is stored in 8 bytes while CHAR(40) is stored in 40 bytes and BINARY(20) in 20 bytes;
    • BIGINT’s serially increasing nature makes it predictable and easy to compare and sort.

    Second best option is the BINARY(20) because it saves some space and it is easier to compare due to reduced length.

    Both BINARY(20) and CHAR(40) are the result of the hashing mechanism and are randomized, hence comparing and sorting takes a longer time on average because randomized data in indexes (for a btree index) needs more tree traversals to fetch (i mean that in the context of multiple values, not for one single value).

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

Sidebar

Related Questions

I have a table articles that has a column company which has list of
I have an order table in MySQL database, having a field/column which stores the
In a table in my datatase I have a datatime column which stores the
I have an ID column in a table which stores the row ID number
I have a table of productList in which i have 4 column, now i
I have a table with a binary column which stores files of a number
i have a table with a column named CustomerName which stores a customer's full
I have a table which has column of descr which stores string values. Some
I have a DATETIME column on my table which stores when a record was
I have a table which has a column called Direct of type char(1). It's

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.