I am going to create shards in mysql table and I am stuck at a dileman whether to go for application layer sharding or let MySQL handle it. I mean, wether I should be figuring out which shard to go and query at application layer or pass on the query to the MySQL driver and let it decide.

I read about some pros and cons of both here but I am unable to come up with a conclusion.

My personal opinion is to go for the MySQL driver handling it. Open for discussion on this.

Please share your views/experiences.

  • I am going to create shards in mysql table Vertical or horizontal? And what's the main goal of this?
    – Akina
    Commented Nov 5, 2019 at 5:04
  • @Akina Vertical shards based in an id. Commented Nov 5, 2019 at 5:28
  • What's the goal? to shard for to shard makes no sense.
    – Akina
    Commented Nov 5, 2019 at 5:30
  • Actually want to divide the media content which id wise (which is going to be a lot) into diffrent shards for efficient search Commented Nov 5, 2019 at 5:32
  • ? Does you want to divide your data array on searcheable and non-searcheable parts? Nevertheless I think that it won't improve searching process.
    – Akina
    Commented Nov 5, 2019 at 5:42

1 Answer 1


Sharding does not speed up searching.

Sharding is useful when you hit a write-scaling limit. Most social media apps end up with some form of sharding to handle many thousands of writes per second.

MySQL has no sharding capability. However, add-ons, such as Spider and various Proxies can help.

Or you can build it into the application layer. In this case, each client must first figure out which database shard to talk to, then talk only to that one. This assumes all the activity can be handled in a single shard.

Sure, the application layer may make use of database tables to keep track of what shards exist, and which item is in which shard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.