# Query and join op after sharding

**URL:** <https://www.ruby-forum.com/t/query-and-join-op-after-sharding/199131>\
**Category:** NGINX\
**Created:** [November 15, 2010, 11:53am UTC](https://www.ruby-forum.com/t/query-and-join-op-after-sharding/199131 "2010-11-15T11:53:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [November 15, 2010, 11:53am UTC](https://www.ruby-forum.com/t/query-and-join-op-after-sharding/199131/1 "2010-11-15T11:53:01Z")

</div>

hi, all

I’m handling something about sharding (or partition) recently. What I  
want  
to do is to add more machines or nodes to my system so that storing more  
data is possibale (maybe scale-out?).

I found many people add a middle layer between their applications and  
databases, mysql for example. That seems to be perfect for me at first  
glance. But then I’m puzzled about the query and join operation.

Q1:  
How to handle queries with offset and limit like:

‘select \* from xxxx where yyyy order by col\_a asc limit num\_b, num\_c’

Just perform the query ‘select \* from xxxx where yyyy order by col\_a asc  
limit 0, num\_b + num\_c’ on each machine, merge the results and return  
[num\_b, num\_b + num\_c)?

Q2:  
How to handle the join operations within different databases?

Sorry for posting sth about database here in nginx forum, I really  
really  
need your help and will be very appreciative for that, thx!

Abioy
