Can't understand results of pg_stat_statements view I configured my postgresql.conf (my version is 9.1) with the normal persistent configuration:

shared_preload_libraries = 'pg_stat_statements,plperl'
custom_variable_classes = 'pg_stat_statements,plperl'
pg_stat_statements.max = 100
pg_stat_statements.track = all
pg_stat_statements.save = on


I let one month to run within a database which is constantly accessed with read/write queries.

After a month (or generally enough time to be sure lots of queries were executed) I do the documentation query with top five slowest queries, and get this result:

-[ RECORD 1 ]---------------------------------------------------------------
query       | UPDATE XXXXXXXX
calls       | 63486
total_time  | 238.271792999997
rows        | 40740
hit_percent | 99.9938060778852878
-[ RECORD 2 ]---------------------------------------------------------------
query       | SELECT XXXXXXXX
calls       | 67347
total_time  | 0.852444000000713
rows        | 67347
hit_percent | 100.0000000000000


... and so on. I see the real number of calls as total_time is (very) much bigger for this queries than this view says. I don't understand how this works, because I expected hours in the total_time field as my server is running for more than 3 months without restarting.

In general is a no-change-from-doc configuration, and I get nonsense results.
I quote the manual (at the page you are linking to, just for the appropriate  version 9.1)


  total_time ... Total time spent in the statement, in seconds


67347 calls totaling 0.852 seconds. That's 0.012 ms per call.
Not uncommon for a simple SELECT.

If that cannot explain it, consider this quote from the manual:


  Note that statements are considered the same if they have the same
  text, regardless of the values of any out-of-line parameters used in
  the statement. Using out-of-line parameters will help to group
  statements together and may make the statistics more useful.


We'd have to study your exact statement(s) to assess that.

There is also the function pg_stat_statements_reset() to reset statistics (superusers only). Are you sure it wasn't called?

And there are a number of configuration parameters to regulate what is tracked. Any fancy settings there?