pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: PGSQL Performance <pgsql-performance@postgresql.org>
To: Venkat Balaji <venkat.balaji@verse.in>
Subject: Re: : Tracking Full Table Scans
Date: Tue, 27 Sep 2011 09:32:14 -0500
Message-ID: <4E81981E02000025000417AA@gw.wicourts.gov> (raw)
In-Reply-To: <CAFrxt0gyMK8aPS9T1DDdvhaOJjnpC7D_x3kcYURVtw-GhKhF3w@mail.gmail.com>
References: <CAFrxt0gyMK8aPS9T1DDdvhaOJjnpC7D_x3kcYURVtw-GhKhF3w@mail.gmail.com>

Venkat Balaji <venkat.balaji@verse.in> wrote:
 
> I am preparing a plan to track the tables undergoing Full Table
> Scans for most number of times.
> 
> If i track seq_scan from the pg_stat_user_tables, will that help
> (considering the latest analyzed ones) ?
 
Well, yeah; but be careful not to assume that a sequential scan is
always a bad thing.  Here's our top ten tables for sequential scans
in a database which is performing quite well:
 
cc=> select seq_scan, n_live_tup, relname
cc->   from pg_stat_user_tables
cc->   order by seq_scan desc
cc->   limit 10;
 seq_scan | n_live_tup |      relname
----------+------------+--------------------
 81264339 |         20 | MaintCode
 16840299 |          3 | DbTranImageStatus
 14905181 |         18 | ControlFeature
 11908114 |         10 | AgingBoundary
  8789288 |         22 | CtofcTypeCode
  7786110 |          6 | PrefCounty
  6303959 |          9 | ProtOrderHistEvent
  5835430 |          1 | ControlRecord
  5466806 |          1 | ControlAccounting
  5202028 |         12 | ProtEventOrderType
(10 rows)
 
You'll notice that they are all very small tables.  In all cases the
entire heap fits in one page, so any form of indexed scan would at
least double the number of pages visited, and slow things down.
 
If you have queries which are not performing to expectations, your
best bet might be to pick one of them and post it here, following
the advice on this page:
 
http://wiki.postgresql.org/wiki/SlowQueryQuestions
 
-Kevin



view thread (8+ messages)  latest in thread

Message-ID: <4E81981E02000025000417AA@gw.wicourts.gov>
Permalink:  ../4E81981E02000025000417AA@gw.wicourts.gov/
Also on:    postgresql.org/message-id/4E81981E02000025000417AA@gw.wicourts.gov

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, venkat.balaji@verse.in
  Subject: Re: : Tracking Full Table Scans
  In-Reply-To: <4E81981E02000025000417AA@gw.wicourts.gov>
  References: <CAFrxt0gyMK8aPS9T1DDdvhaOJjnpC7D_x3kcYURVtw-GhKhF3w@mail.gmail.com> <4E81981E02000025000417AA@gw.wicourts.gov>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox