This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-17
Channels
- # bangalore-clj (4)
- # beginners (60)
- # boot (63)
- # cider (2)
- # cljs-dev (22)
- # cljsrn (3)
- # clojars (32)
- # clojure (133)
- # clojure-gamedev (1)
- # clojure-germany (17)
- # clojure-italy (1)
- # clojure-russia (11)
- # clojure-serbia (16)
- # clojure-spec (35)
- # clojure-uk (75)
- # clojurebridge (1)
- # clojurescript (83)
- # community-development (25)
- # core-async (43)
- # cursive (15)
- # datomic (28)
- # emacs (2)
- # fulcro (108)
- # graphql (5)
- # hoplon (15)
- # lein-figwheel (6)
- # leiningen (39)
- # lumo (106)
- # new-channels (1)
- # off-topic (4)
- # om (26)
- # om-next (53)
- # onyx (46)
- # other-languages (2)
- # perun (1)
- # protorepl (5)
- # re-frame (13)
- # ring (18)
- # ring-swagger (1)
- # rum (6)
- # shadow-cljs (82)
- # spacemacs (19)
- # specter (5)
- # sql (3)
- # test-check (31)
- # unrepl (12)
- # untangled (2)
- # vim (109)
SQL Server offers a pagination syntax like so:
SELECT col1, col2, ...
FROM ...
WHERE ...
ORDER BY -- this is a MUST there must be ORDER BY statement
-- the paging comes here
OFFSET 10 ROWS -- skip 10 rows
FETCH NEXT 10 ROWS ONLY; -- take 10 rows
is there something similar for queries in Datomic for pagination? or is it something like sorting and i would have to do outside the query?pagination is generally less useful when you have the data in your peer already anyway
but what people usually do when they have queries that return too much data? it would stay in memory for a moment because you're paginating after the query execution
that's generally difficult to avoid. That would have to happen on a database server too
you're right. the first thing i can think of would be to perform a query that retrieves the ids, then i'd paginate the ids and use them on a second query, that would retrieve the expected result using something like min max
the only optimization I could think of is if you wanted to paginate without sorting, i.e. in whatever order the peer walks the index
maybe just retrieving the IDs could work, yeah. Unless they're just stored in the same chunks as most of the data anyway
my mental model of the organization of data in the cunks is lacking, so not sure if doing ids first would help...
i'm not sure, either. because if the pagination depends on some sort of ordering this resolution model wouldn't be that great, in the first query i'd have to retrieve the ids and the other attributes required for the sorting before the pagination
the attribuets you sort on are probably indexed I suppose? Then I would assume that the data are mostly in the same chunks in avet anyway
or, wait. Does each index have its own set of chunks? Then at least you'd only have the indexed attributes in avet. I think?
avet only contains the actual data that is indexed, I suppose? And if you need additional facts, you'd need to look it up in eavt or elsewhere
oh, i didn't know there was indexes in Datomic, just checked the docs and there's a page on that, I guess I'll have to study xD
doing so would affect the query results so that ordering would be done over the tagged attribute?
the indices started making sense to me after I started to play with the "datoms" API, that gives you direct access to the indices
each index is a nested sorted set of data, nested differently. Or something like that. So "eavt" lets you input an e (entity id ) and get all attributes for that entity. Then you add an a and you get all values for that attribute. Then you walk those to find the attribute closest to the T of the db you're accessing