Database error: "sql: transaction has already been committed or rolled back"

Yes deleting them on the storage device won’t have any impact.

I’ve been trying to reproduce the issue at hand, and I’m pretty sure I’ve found where the problem is, although I’ve not been able to reproduce the Failed to get snapshots: Failed to fetch from "config" table: sql: Rows are closed. But perhaps my system is faster/less loaded than yours and is still able to return the result sets within before the timeout.

Anyway, irrespective of that I can see certainly see a slow down of the lxc ls command for instances with hundreds of snapshots.

My working PR is here:

https://github.com/lxc/lxd/pull/10712

In my tests I reduced the lxd list time from 8.5s to 0.9s.