relevance / diametric

Diametric is a library for building schemas, queries, and transactions for Datomic from Ruby objects.
MIT License
169 stars 28 forks source link

Query string generation should be improved #25

Open yokolet opened 11 years ago

yokolet commented 11 years ago

Currently, a query string holds all attributes for any query. This doesn't matter if a model has a couple of attributes. But, if the model has 100 attributes, 100 attributes will present in the single query string even though only one of attribute is needed.

Another problem is that the query string is generated every time the query happens. This will cause a performance issue especially under the circumstance that millions of queries rush within a minutes.

avescodes commented 11 years ago

I've been toying with Query string generation (more generally fully-realized sets of attributes vs. lazy attributes).

Lazy attributes would certainly be more in line with the clojure/datomic way of doing things, but it is definitely a digression from what rubyists are accustomed to.

Any opinions?

On Tuesday, December 4, 2012 at 9:39 AM, Yoko Harada wrote:

Currently, a query string holds all attributes for any query. This doesn't matter if a model has a couple of attributes. But, if the model has 100 attributes, 100 attributes will present in the single query string even though only one of attribute is needed. Another problem is that the query string is generated every time the query happens. This will cause a performance issue especially under the circumstance that millions of queries rush within a minites.

— Reply to this email directly or view it on GitHub (https://github.com/relevance/diametric/issues/25).

yokolet commented 11 years ago

Very interesting. But, would you explain about lazy attributes a bit more? Or, would you give me links I should look at?

We've already broken Ruby style API to use good side of Datomic. If lazy attributes contribute to performance, we should take that in.