SupabaseS
Supabase12mo ago
Big dog

Potential Bug in SQL Editor?

Hey everyone,

Am potentially seeing a bug in the SQL editor. My current setup:
  • primary database in us-east-1
  • read replica in us-west-1
I was trying to do some debugging on my client connections, when I found that I was getting inconsistent results when running queries in the SQL editor.

I ran this query:
SELECT 
    usename,
    application_name,
    client_addr,
    state,
    EXTRACT(EPOCH FROM (now() - state_change))::INTEGER as idle_seconds,
    query as last_query
FROM pg_stat_activity 
WHERE state = 'idle'
ORDER BY state_change DESC;

First I ran this query with the source as the Primary, and then switched it to Read Replica. No issues here, but if I left the tab open and the source still selected at Read Replica, and came back to it after ~10 minutes, hitting run again would show the results for the Primary. I'm pretty confident this was the case, as I was seeing queries with INSERT in the results, but my Read Replica has no INSERTs. Switching the source to Primary and then back to Read Replica seems to fix the issue.

Not critical, but super confusing for a bit. Wonder if others see the same issue.
Was this page helpful?