DEVLOPN Audit

My free Supabase project paused every 7 days — fixed with 5 lines of SQL

Supabase's free plan pauses your project after 7 days of inactivity. An elegant fix with pg_cron — the database generates its own activity from within.

If you host a side project on Supabase's free plan, you know the pain: 7 days without activity, the project goes to sleep, and your app serves a 503 at the worst possible moment.

Never let your DB sleep — keep your free Supabase project alive from the inside with pg_cron

The elegant fix

Keep the database alive from the inside, with pg_cron, already available on Supabase.

The idea:

  • a tiny "sentinel" table (zero business data, locked down with RLS)
  • a function that writes a timestamp into it
  • a scheduled job that runs on its own
create extension if not exists pg_cron;
select cron.schedule(
  'keep-alive',
  '0 6 */2 * *',  -- every 2 days at 6am
  $$ update public.keep_alive set last_ping = now() where id = 1; $$
);

The database generates its own activity, so the inactivity counter never reaches zero.

The irony

Somewhere, a server stays lit all night just to write "I'm alive" into a table. 💡

Got a greener solution? I'm all ears. 🌱