Files
speckle-server/test-queries/closure-fullcount.sql
T
Dimitrie Stefanescu 1a4442b5a7 feat(queries): implemented fast query route for children
and started scaffolding the slower, filter enabled one
2020-05-07 21:10:49 +01:00

20 lines
555 B
SQL

with objs as (
SELECT
id,
"data"
FROM object_children_closure
JOIN objects ON objects.id = child
WHERE parent = '89b42e4109f32b20763243d4313e81b5'
-- AND "minDepth" < 1000
AND (jsonb_path_query("data", '$.sortValueA.test.value'))::numeric <= 10
-- AND (objects."data" -> 'sortValueA')::numeric > 100
ORDER BY id
)
SELECT * FROM objs
RIGHT JOIN (SELECT count(*) FROM objs ) c(total_count) ON TRUE
OFFSET 0
LIMIT 200
-- with "objs" as (select *) select * from "objs" RIGHT JOIN ( SELECT count(*) FROM "objs" ) c(total_count) ON TRUE limit 50