Remove lines of a table

Is there a way to clear off a table?
I use Baserow for logging and have literally millions of lines in these logs and it is wasting space and bloating my Postgres. How do I clear a table?

Like… it would be really awesome to set a filter like Date before and just remove everything on that table older than a month! Or even just clear the whole table… I don’t care. But it would be really annoying if I have to make a new table every month just because i wanted to delete a million lines.

1 Like


@olgatrykush is checking if batch delete is possible.

But with millions of lines this will still be a lot of work. A secure empty table option would be a good idea.

Hi @roofboard, I’m Peter (another one! :slight_smile: ), a full-stack dev at Baserow.

The problem you’re facing is definitely something we’re aware of, and in the future, we’d like to make the process a little easier to manage from within the UI. Two ideas we have are:

  1. The ability to “select all” (visible) rows, allowing more rows to be deleted at once.
  2. The ability to truncate a whole table, clearing it of all of its rows.

Unfortunately at the moment we have neither, but I can suggest three ideas you could try today:

  1. You say you’re logging millions of rows in your table, could you perhaps programmatically rotate tables when you reach a specific size? E.g. once your table reaches ~250K rows, create a new one using the API, and then write another ~250K rows?
  2. As @Peter and @olgatrykush suggested, you could look at using the batch_delete_database_table_rows endpoint, in chunks of ~1000 at a time.
  3. If you’re happy with emptying your table of rows, and you don’t mind losing the data, you could always issue a TRUNCATE on your table. Just be sure to backup your table if you do want to keep the data!

I hope this helps.

1 Like