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 7602075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:19:12+00:00 2026-05-30T23:19:12+00:00

I have a database table (MySQL 5) which stores file hashes and filenames. I

  • 0

I have a database table (MySQL 5) which stores file hashes and filenames. I am indexing thousands of files. I don’t have a primary key set because I want to index all files even if they are duplicates but in different locations. So if I have 2 files X.bin and Y.bin, even if the file hash is the same I want to insert them both into my table because they have different file names.

The only time I don’t want to insert a duplicate is when the filename and file hash already exist in the system. For that I need to do a query on the file hash. This is where it takes a long time. I am using SHA256 hash which is 64 characters in length. I have thousands of records in the database and when I do a query on a single hash it takes 5 seconds.

My query is:

SELECT FileName FROM fileinfo WHERE FileHash='qazwsxedcrfvtgbyhnujm'

Other than using a different file hash like MD5 which is 32 chars in length, is there anything else I can do to speed up the query?

Thanks

  • 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-05-30T23:19:14+00:00Added an answer on May 30, 2026 at 11:19 pm

    Try to add key index on FileHash column.Not unique, simple key index:

    ALTER TABLE fileinfo
    ADD INDEX FileHash (FileHash)
    

    Make EXPLAIN SELECT … before this alter and just after it.

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

Sidebar

Related Questions

I have an order table in MySQL database, having a field/column which stores the
i have a large mysql database table in which one column contains values ranging
Greetings friends, In my MySQL database, I have 'MAB' table which contains information about
I have a MySQL database and a table which has a names column as
I have a mysql database which has grown to over 200 tables in it.
I have a MySQL database with multiple tables, each of which have the same
I have a MySQL database table with a couple thousand rows. The table is
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have a MySQL database with a fairly large table where the products are.
I have a user table in my mysql database that has a password column.

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.