Go back to INNER JOIN on mod_cell_counts instead

This saves a lot of space and there's no real need to differentiate between 0 and does not exist.
This commit is contained in:
Tyler Hallada 2022-03-18 00:28:23 -04:00
parent 02c03bd1d9
commit 65f841eef3

View File

@ -398,8 +398,8 @@ pub async fn batched_get_cell_counts(
mods.nexus_mod_id, mods.nexus_mod_id,
COUNT(DISTINCT cells.*) FILTER (WHERE cells.x IS NOT NULL AND cells.y IS NOT NULL AND cells.master = $3 AND cells.world_id = $4) AS cells COUNT(DISTINCT cells.*) FILTER (WHERE cells.x IS NOT NULL AND cells.y IS NOT NULL AND cells.master = $3 AND cells.world_id = $4) AS cells
FROM mods FROM mods
LEFT OUTER JOIN plugin_cells ON plugin_cells.mod_id = mods.id INNER JOIN plugin_cells ON plugin_cells.mod_id = mods.id
LEFT OUTER JOIN cells ON cells.id = plugin_cells.cell_id INNER JOIN cells ON cells.id = plugin_cells.cell_id
WHERE mods.nexus_mod_id > $2 WHERE mods.nexus_mod_id > $2
GROUP BY mods.nexus_mod_id GROUP BY mods.nexus_mod_id
ORDER BY mods.nexus_mod_id ASC ORDER BY mods.nexus_mod_id ASC