Optimize accessible
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
I think this query is more efficient than the current one.
But it's "difficult" to refactor because we currently get itemmemberships, which helps building packed items later. Starting by the table item with typeorm forces you to only get item. Might work if it had a relation `item_memberships`
Also typeorm cannot translate well the `With As` syntax.
```
-- WITH r AS
-- (SELECT i.id, i.path, row_number() OVER (ORDER BY path) rn FROM "item" "i" INNER JOIN "item_membership" "im" ON "i"."path" = "im"."item_path" AND "im"."account_id" = WHERE "i"."deleted_at" IS NULL ORDER BY "i"."path" ASC)
-- SELECT *
-- FROM r "a"
-- WHERE rn <= (SELECT rn FROM r WHERE r.path @> a.path order by rn limit 1);
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.