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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:03:37+00:00 2026-05-10T18:03:37+00:00

Currently, I’ve got images (max. 6MB) stored as BLOB in a InnoDB table. As

  • 0

Currently, I’ve got images (max. 6MB) stored as BLOB in a InnoDB table. As the size of the data is growing, the nightly backup is growing slower and slower hindering normal performance.

So, the binary data needs to go to the file system. (pointers to the files will be kept in the DB.)

The data has a tree like relation:

- main site   - user_0     - album_0     - album_1     - album_n   - user_1   - user_n etc... 

Now I want the data to be distributed evenly trough the directory structure. How should I accomplish this?

I guess I could try MD5('userId, albumId, imageId'); and slice up the resulting string to get my directory path:

   /var/imageStorage/f/347e/013b/c042/51cf/985f7ad0daa987d.jpeg 

This would allow me to map the first character to a server and evenly distribute the directory structure over multiple servers.

This would however not keep images organised per user, likely spreading the images for 1 album over multiple servers.

My question is:
What is the best way to store the image data in the file system in a balanced way, while keeping user/album data together ?

Am I thinking in the right direction? or is this the wrong way of doing things altogether?

Update:
I will go for the md5(user_id) string slicing for the split up on highest level. And then put all user data in that same bucket. This will ensure an even distribution of data while keeping user data stored close together.

   /var    - imageStorage      - f/347e/013b        - f347e013bc04251cf985f7ad0daa987d          - 0            - album1_10              - picture_1.jpeg          - 1            - album1_1              - picture_2.jpeg              - picture_3.jpeg            - album1_11              - picture_n.jpeg          - n            - album1_n 

I think I will use albumId splitted up from behind (I like that idea!) as to keep the number of albums per directory smaller (although it won’t be necessary for most users).

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. 2026-05-10T18:03:38+00:00Added an answer on May 10, 2026 at 6:03 pm

    Just split your userid from behind. e.g.

    UserID = 6435624  Path = /images/24/56/6435624 

    As for the backup you could use MySQL Replication and backup the slave database to avoid problems (e.g. locks) while backuping.

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

Sidebar

Related Questions

Currently I have a date in my clients data table and it is stored
Currently I have 2 ways of displaying images in a cell, which way will
Currently my query is very heavy, the table (table A) I need to update
Currently, I have a log file of messages in one table in a MySQL
Currently I'm using the Jackson JSON Processor to write preference data and whatnot to
Currently using a MySQL database Wanting to insert a new row into a table
Currently I have a UITableview, I have enough data that cannot be shown entirely
Currently I got this rewrite rule in my .htaccess to pass the [value] in
Currently, if I want to output a SQL script for a table in my
Currently I know of only two ways to cache data (I use PHP but

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.