Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Shard the ArticleUserAuthorization table by user_id. The principle is to reduce the effective dataset size on the access path. Some data will be accessed more frequently than others, also it be be accessed in a particular way. On that path the size of the resultset should be small. Here we do that by having a shard. Also, optimize that path more by maybe having an index if it is a read workload, cache it etc</p> <p>This particular shard is useful if you want all the articles authorized by a user.<br> If you want to query by article as well, then duplicate the table and shard by article_id as well. When we have this second sharding scheme, we have denormalized the data. The data is now duplicated and the application would need to do extra work to maintain data-consistency. Writes also will be slower, use a queue for writes</p> <p>Problem with sharding is that queries across shards is ineffectve, you will need a separate reporting database. Pick a sharding scheme and think about recomputing shards.</p> <p>For truly massive databases, you would want to split it across physical machines. eg. one or more machines per user's articles. </p> <p>some nosql suggestions are:</p> <ol> <li>relationships are graphs. so look at graph databases. particularly<br> <a href="https://github.com/twitter/flockdb" rel="nofollow">https://github.com/twitter/flockdb</a></li> <li>redis, by storing the relationship in a list.</li> <li>column-oriented database like hbase. can treat it like a sparse nested hash</li> </ol> <p>all this depends on the size of your database and the types of queries</p> <p>EDIT: modified answer. the question previously had 'had_one' relationships Also added nosql suggestions 1 &amp; 2</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload