https://supabase.com/ logo
#off-topic
Title
# off-topic
j

JustTheSyme

11/30/2021, 9:32 PM
I'm getting a connection error saying
"could not extend file \"base/12662/16813\": No space left on this device
when trying to insert to my database. I'm on using a 1/3 of the database's alloted space. What might be going on here?
s

Scott P

11/30/2021, 9:34 PM
It depends how big the data is that you're trying to insert. I came across this when I had a large dataset already in my DB and was trying to insert another large amount of data.
j

JustTheSyme

11/30/2021, 9:44 PM
I was saving a fairly large json payload. Excluding that seems to fix the problem, but I'm confused why it was breaking just now. I've been saving the same payloads for a week with no problem and the database size doesn't increase because I'm only rewriting to a fixed number of rows.
s

Scott P

11/30/2021, 10:01 PM
It might be worth running
VACUUM
from the SQL terminal on the dashboard. Essentially, each time you perform an update on a table, the original record is kept in the database and
VACUUM
helps remove these dead references - More details: https://www.postgresql.org/docs/9.5/sql-vacuum.html I'd even recommend running
VACUUM ANALYZE
so that it updates stats on query executions.
VACUUM FULL
is more intensive, but will cause table locking and so should only be used if you're not expecting traffic. If you only want to use it against a specific table, run
VACUUM [table_name]
. You can also run
REINDEX INDEX [index_name]
if you've got indexes and this will recreate the index which might also clean them up and reduce space usage (and optimise performance at the same time) - More details: https://www.postgresql.org/docs/9.4/sql-reindex.html
j

JustTheSyme

12/01/2021, 12:05 AM
Thanks for your help! I was about to do this, but then discovered my site was down due to not being able to access the database and now I'm getting this error in the supabase console:
I've spun up a second database for now, but I'm not sure why the original is refusing connections like this. Is there some way to recover from this?