Clear data in postgres

Hello

my postgresql is growing every day and I cant clean it up

I use

REDASH_QUERY_RESULTS_CLEANUP_ENABLED = correct
REDASH_QUERY_RESULTS_CLEANUP_COUNT = 10
REDASH_QUERY_RESULTS_CLEANUP_MAX_AGE = 1

but nothing works

Which table is growing? Do you think the cleanup job is not running?

public.query_results | 79 GB
public.events | 924 MB
public.queries | 1456 kB
public.changes | 776 kB
public.visualizations | 664 kB
public.widgets | 392 kB
public.users | 152 kB
public.data_sources | 96 kB
public.dashboards | 80 kB
public.organizations | 80 kB
public.api_keys | 64 kB
public.notification_destinations | 48 kB
public.favorites | 40 kB
public.alert_subscriptions | 40 kB
public.groups | 32 kB
public.alerts | 32 kB
public.data_source_groups | 24 kB
public.alembic_version | 24 kB
public.query_snippets | 24 kB
public.access_permissions | 16 kB

How big do you expect the query results table to grow? The size alone isn’t an issue without other context.

the increase every day is ~8-9 GB

I would like to clean at least once a week, and preferably every 3-4 days

Oh wow. Is there a typo in your original message?

This should be True not correct.

hmmm
yes, it typo =) i have true )

How many workers and of what kinds do you have in your deployment? It’s possible the worker isn’t running at all.

  - REDASH_WEB_WORKERS=10

today i use manage.py shell:

from redash.tasks import cleanup_query_results
cleanup_query_results()

clean ~100000 queries, but the place was not vacated

Have you tried running a VACUUM command on the database file? I don’t think postgres releases the disk space automatically.