Files
speckle-server/test-queries/materialised-simple-ordinality.sql
T
Dimitrie Stefanescu 85cc525663 feat(queries): figuring out the perfect querie for getting objects
quite a few things are being considered, perf. wise: pagination, ordering, querying, depth.
2020-05-04 16:25:37 +01:00

11 lines
273 B
SQL

WITH ids as (
SELECT (subltree("path", 2, 3))::text as obj_id
FROM object_tree_refs
WHERE path ~ '0_hash.*{2}'
ORDER BY id
)
SELECT id, speckle_type, "data" -> 'nest' -> 'orderMe'
FROM ids
JOIN objects ON obj_id = objects.id WITH ORDINALITY
OFFSET 2
LIMIT 50