select
commits.commit_at as _commit_at,
commits.hash as _commit_hash,
item_version.*,
(
select json_group_array(name) from columns
where id in (
select column from item_changed
where item_version = item_version._id
)
) as changed_columns
from
item_version
join commits on commits.id = item_version._commit
join item_changed on item_version._id = item_changed.item_version
I tried this with a join and group by instead of that nested select json_group_array but the performance was terrible, presumably because it has to calculate for every single row as opposed to the subset of rows returned on the page.
Including the list of columns is useful:
I tried this with a join and group by instead of that nested
select json_group_array
but the performance was terrible, presumably because it has to calculate for every single row as opposed to the subset of rows returned on the page.