# Horizontal partitioning of database to scale the ROR application

**URL:** <https://www.ruby-forum.com/t/horizontal-partitioning-of-database-to-scale-the-ror-application/181258>\
**Category:** Rails\
**Created:** [January 8, 2010, 10:49am UTC](https://www.ruby-forum.com/t/horizontal-partitioning-of-database-to-scale-the-ror-application/181258 "2010-01-08T10:49:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankit\_Varshney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@Ankit\_Varshney](https://www.ruby-forum.com/u/Ankit_Varshney)\
**Post date:** [January 8, 2010, 10:49am UTC](https://www.ruby-forum.com/t/horizontal-partitioning-of-database-to-scale-the-ror-application/181258/1 "2010-01-08T10:49:46Z")

</div>

I want to do horizontal partitioning of database to scale my  
application. Is there any way to do that Ruby on Rails application.

---

<div class="post-metadata">

**Author:** ![Ankit\_Varshney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@Ankit\_Varshney](https://www.ruby-forum.com/u/Ankit_Varshney)\
**Post date:** [January 8, 2010, 11:55am UTC](https://www.ruby-forum.com/t/horizontal-partitioning-of-database-to-scale-the-ror-application/181258/2 "2010-01-08T11:55:19Z")

</div>

Masochism can solve your problem definitely(An easy solution for Ruby  
on Rails applications to work in a replicated database environment)

> **[GitHub - technoweenie/masochism: ActiveRecord connection proxy for...](https://github.com/technoweenie/masochism)**
>
> ActiveRecord connection proxy for master/slave connections - GitHub - technoweenie/masochism: ActiveRecord connection proxy for master/slave connections

~  
Ankur G.  
Hyderabad, India

---

<div class="post-metadata">

**Author:** ![Ankit\_Varshney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@Ankit\_Varshney](https://www.ruby-forum.com/u/Ankit_Varshney)\
**Post date:** [January 8, 2010, 12:00pm UTC](https://www.ruby-forum.com/t/horizontal-partitioning-of-database-to-scale-the-ror-application/181258/3 "2010-01-08T12:00:00Z")

</div>

That is good plugin but instead of based on the ActiveRecord method call  
I  
want to do it on the query type. If the query is insert/update/delete  
then  
query will execute on master database otherwise all the select query  
will  
execute on slave.

---

<div class="post-metadata">

**Author:** ![Ankit\_Varshney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@Ankit\_Varshney](https://www.ruby-forum.com/u/Ankit_Varshney)\
**Post date:** [January 8, 2010, 4:29pm UTC](https://www.ruby-forum.com/t/horizontal-partitioning-of-database-to-scale-the-ror-application/181258/4 "2010-01-08T16:29:49Z")

</div>

Ankit Varshney wrote:

> I want to do horizontal partitioning of database to scale my  
> application. Is there any way to do that Ruby on Rails application.

Why not let the DB server do this? Most good DB servers have  
intelligent ways of splitting the DB and still letting it appear as one  
DB to the app. Check the docs for your server.

Best,  
–Â  
Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
