pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedReset DB stats suggestion pg_stat_reset()
6+ messages / 3 participants
[nested] [flat]
* Reset DB stats suggestion pg_stat_reset()
@ 2020-02-22 08:26 postggen2020 s <postggen2020@gmail.com>
2020-02-22 17:17 ` Re: Reset DB stats suggestion pg_stat_reset() Adrian Klaver <adrian.klaver@aklaver.com>
2020-02-24 17:54 ` Re: Reset DB stats suggestion pg_stat_reset() Michael Lewis <mlewis@entrata.com>
0 siblings, 2 replies; 6+ messages in thread
From: postggen2020 s @ 2020-02-22 08:26 UTC (permalink / raw)
To: pgsql-general@postgresql.org; pgsql-admin
Hi Team,
Good Afternoon,
We have seen some deadlocks and tempfile count in pg_stat_database view. We
are trying to reset the stats.
Can we use pg_stat_reset() function to reset these stats without any impact
stats of databases.
Please advise the process to reset the stats.
Thanks.
Postggen.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Reset DB stats suggestion pg_stat_reset()
2020-02-22 08:26 Reset DB stats suggestion pg_stat_reset() postggen2020 s <postggen2020@gmail.com>
@ 2020-02-22 17:17 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-02-23 02:40 ` Re: Reset DB stats suggestion pg_stat_reset() postggen2020 s <postggen2020@gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: Adrian Klaver @ 2020-02-22 17:17 UTC (permalink / raw)
To: postggen2020 s <postggen2020@gmail.com>; pgsql-general@postgresql.org; pgsql-admin
On 2/22/20 12:26 AM, postggen2020 s wrote:
> Hi Team,
>
> Good Afternoon,
>
> We have seen some deadlocks and tempfile count in pg_stat_database view.
> We are trying to reset the stats.
> Can we use pg_stat_reset() function to reset these stats without any
> impact stats of databases.
> Please advise the process to reset the stats.
See here:
https://www.postgresql.org/docs/12/monitoring-stats.html
Table 27.20. Additional Statistics Functions
It details what your options are.
>
> Thanks.
> Postggen.
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Reset DB stats suggestion pg_stat_reset()
2020-02-22 08:26 Reset DB stats suggestion pg_stat_reset() postggen2020 s <postggen2020@gmail.com>
2020-02-22 17:17 ` Re: Reset DB stats suggestion pg_stat_reset() Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-02-23 02:40 ` postggen2020 s <postggen2020@gmail.com>
2020-02-23 18:19 ` Re: Reset DB stats suggestion pg_stat_reset() Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 6+ messages in thread
From: postggen2020 s @ 2020-02-23 02:40 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@postgresql.org; pgsql-admin
Thanks Adrian.
I am aware about the functions. Here need is, can we use this?.or is there
any known effects after firing the functions?.
Thanks,
Postgann.
On Sat, Feb 22, 2020 at 10:47 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:
> On 2/22/20 12:26 AM, postggen2020 s wrote:
> > Hi Team,
> >
> > Good Afternoon,
> >
> > We have seen some deadlocks and tempfile count in pg_stat_database view.
> > We are trying to reset the stats.
> > Can we use pg_stat_reset() function to reset these stats without any
> > impact stats of databases.
> > Please advise the process to reset the stats.
>
> See here:
>
> https://www.postgresql.org/docs/12/monitoring-stats.html
>
> Table 27.20. Additional Statistics Functions
>
> It details what your options are.
>
> >
> > Thanks.
> > Postggen.
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Reset DB stats suggestion pg_stat_reset()
2020-02-22 08:26 Reset DB stats suggestion pg_stat_reset() postggen2020 s <postggen2020@gmail.com>
2020-02-22 17:17 ` Re: Reset DB stats suggestion pg_stat_reset() Adrian Klaver <adrian.klaver@aklaver.com>
2020-02-23 02:40 ` Re: Reset DB stats suggestion pg_stat_reset() postggen2020 s <postggen2020@gmail.com>
@ 2020-02-23 18:19 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-02-23 19:25 ` Re: Reset DB stats suggestion pg_stat_reset() Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 6+ messages in thread
From: Adrian Klaver @ 2020-02-23 18:19 UTC (permalink / raw)
To: postggen2020 s <postggen2020@gmail.com>; +Cc: pgsql-general@postgresql.org; pgsql-admin
On 2/22/20 6:40 PM, postggen2020 s wrote:
> Thanks Adrian.
> I am aware about the functions. Here need is, can we use this?.or is
> there any known effects after firing the functions?.
Yes the stats counters will be reset to 0, which means the planner will
not have accurate statistics to work with. That can be corrected with an
ANALYZE. The questions I have are:
What is the issue you are trying to deal with?
Also why do you think resetting the stats will fix it?
>
> Thanks,
> Postgann.
>
> On Sat, Feb 22, 2020 at 10:47 PM Adrian Klaver
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
>
> On 2/22/20 12:26 AM, postggen2020 s wrote:
> > Hi Team,
> >
> > Good Afternoon,
> >
> > We have seen some deadlocks and tempfile count in
> pg_stat_database view.
> > We are trying to reset the stats.
> > Can we use pg_stat_reset() function to reset these stats without any
> > impact stats of databases.
> > Please advise the process to reset the stats.
>
> See here:
>
> https://www.postgresql.org/docs/12/monitoring-stats.html
>
> Table 27.20. Additional Statistics Functions
>
> It details what your options are.
>
> >
> > Thanks.
> > Postggen.
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Reset DB stats suggestion pg_stat_reset()
2020-02-22 08:26 Reset DB stats suggestion pg_stat_reset() postggen2020 s <postggen2020@gmail.com>
2020-02-22 17:17 ` Re: Reset DB stats suggestion pg_stat_reset() Adrian Klaver <adrian.klaver@aklaver.com>
2020-02-23 02:40 ` Re: Reset DB stats suggestion pg_stat_reset() postggen2020 s <postggen2020@gmail.com>
2020-02-23 18:19 ` Re: Reset DB stats suggestion pg_stat_reset() Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-02-23 19:25 ` Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 6+ messages in thread
From: Adrian Klaver @ 2020-02-23 19:25 UTC (permalink / raw)
To: postggen2020 s <postggen2020@gmail.com>; +Cc: pgsql-general@postgresql.org; pgsql-admin
On 2/23/20 10:19 AM, Adrian Klaver wrote:
> On 2/22/20 6:40 PM, postggen2020 s wrote:
>> Thanks Adrian.
>> I am aware about the functions. Here need is, can we use this?.or is
>> there any known effects after firing the functions?.
>
> Yes the stats counters will be reset to 0, which means the planner will
> not have accurate statistics to work with. That can be corrected with an
> ANALYZE.
I should have listened to the little voice that told me to confirm the
above. The reset will reset the counters in the tables listed here:
https://www.postgresql.org/docs/12/monitoring-stats.html#MONITORING-STATS-VIEWS
It does not change the statistics here:
https://www.postgresql.org/docs/12/catalog-pg-statistic.html
Therefore an ANALYZE is not strictly required.
The questions below still hold though.
The questions I have are:
>
> What is the issue you are trying to deal with?
>
> Also why do you think resetting the stats will fix it?
>
>
>>
>> Thanks,
>> Postgann.
>>
>> On Sat, Feb 22, 2020 at 10:47 PM Adrian Klaver
>> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
>>
>> On 2/22/20 12:26 AM, postggen2020 s wrote:
>> > Hi Team,
>> >
>> > Good Afternoon,
>> >
>> > We have seen some deadlocks and tempfile count in
>> pg_stat_database view.
>> > We are trying to reset the stats.
>> > Can we use pg_stat_reset() function to reset these stats
>> without any
>> > impact stats of databases.
>> > Please advise the process to reset the stats.
>>
>> See here:
>>
>> https://www.postgresql.org/docs/12/monitoring-stats.html
>>
>> Table 27.20. Additional Statistics Functions
>>
>> It details what your options are.
>>
>> >
>> > Thanks.
>> > Postggen.
>>
>>
>> -- Adrian Klaver
>> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Reset DB stats suggestion pg_stat_reset()
2020-02-22 08:26 Reset DB stats suggestion pg_stat_reset() postggen2020 s <postggen2020@gmail.com>
@ 2020-02-24 17:54 ` Michael Lewis <mlewis@entrata.com>
1 sibling, 0 replies; 6+ messages in thread
From: Michael Lewis @ 2020-02-24 17:54 UTC (permalink / raw)
To: postggen2020 s <postggen2020@gmail.com>; +Cc: pgsql-general <pgsql-general@postgresql.org>
>
> We have seen some deadlocks and tempfile count in pg_stat_database view.
> We are trying to reset the stats.
> Can we use pg_stat_reset() function to reset these stats without any
> impact stats of databases.
> Please advise the process to reset the stats.
>
Yes, you could reset stats every month or week or whatever you decide makes
sense so you have an understanding of the timeline. Else, knowing that an
index has been used X times since who-knows-when is not a very useful piece
of information. I have occasionally reset the stats on all indexes on a
table when adding or removing an index from that table so that I have an
accurate idea of whether index_xyz or index_abc gets used. You can take a
snapshot of the stats on the table occasionally and compare prior count to
new count if you prefer. I find reset to be cleaner.
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2020-02-24 17:54 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-02-22 08:26 Reset DB stats suggestion pg_stat_reset() postggen2020 s <postggen2020@gmail.com>
2020-02-22 17:17 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-02-23 02:40 ` postggen2020 s <postggen2020@gmail.com>
2020-02-23 18:19 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-02-23 19:25 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-02-24 17:54 ` Michael Lewis <mlewis@entrata.com>
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