News for hackers. Stuff that matters.
Re:Understanding Postgres Performance by Axsuul on Tuesday October 02, 2012 @06:09PM (#4604642)
A better query to see how indexes are used to avoid division by zero errors.

  SELECT 
    relname, 
    CASE 
      WHEN seq_scan = 0 THEN 0 
      ELSE 100 * idx_scan / (seq_scan + idx_scan) 
    END AS percent_of_times_index_used, 
    n_live_tup rows_in_table
  FROM 
    pg_stat_user_tables 
  ORDER BY 
    n_live_tup DESC;

There are no comments on this comment yet.