Skip to content

Commit

Permalink
Hide pg_stat_xact_user_tables information from TLF graphs
Browse files Browse the repository at this point in the history
Now that table usage tracking works for all callers, the graphs
quickly grew bigger than necessary.  Now the only information we
show is the name of the table and whether it was written to, or
only read from.  UPDATE and DELETE both require a seq/idx scan
before they can modify the data so we can't realiably tell the user
that "this table is only written to"; it would only work for
INSERTs.
  • Loading branch information
johto committed Oct 4, 2012
1 parent e310f66 commit e7f2e65
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions utils/TableUsageGraphs.pm
Expand Up @@ -52,22 +52,22 @@ sub draw_tlfgraph
open(my $pipe, "| dot -Tsvg -o $graphdir/tlf$toplevelfunction.svg") or die "could not fork";

print $pipe "strict digraph $graph->{toplevelfunctionname} {\n";
print $pipe "rankdir = LR;\nnode [shape=record]\n";
print $pipe "rankdir = LR;\nnode [shape=rectangle]\n";

my $tables = $graph->{tables};
foreach my $table (keys %{$tables})
{
foreach my $referenced_table (@{$tables->{$table}->{confrelids}})
{
print $pipe "\"$table\":name -> \"$referenced_table\":name;\n";
print $pipe "\"$table\" -> \"$referenced_table\";\n";
}

my $tref = $tables->{$table};
print $pipe "\"$table\" [label=\"<name> $tref->{relname}|" .
"sequential scans: $tref->{seq_scan}|avg seq tuples: $tref->{seq_tup_read}|" .
"index scans: $tref->{idx_scan}|avg idx tuples: $tref->{idx_tup_read}|" .
"inserted rows: $tref->{n_tup_ins}|updated rows: $tref->{n_tup_upd}|" .
"deleted rows: $tref->{n_tup_del}\", href=\"r$table.svg\"]\n";

# read-only tables should be dashed
my $style = "dashed";
$style = "" if ($tref->{n_tup_ins} > 0 || $tref->{n_tup_upd} > 0 || $tref->{n_tup_del} > 0);
print $pipe "\"$table\" [label=\"$tref->{relname}\", href=\"r$table.svg\" style=\"$style\"]\n";
}

print $pipe "}\n";
Expand Down

0 comments on commit e7f2e65

Please sign in to comment.