PostgreSQL statistics

2023-11-17 Thread Paulo Silva
Hi,

I have a table in a PostgreSQL 11 server that isn't being used a lot.

If I run a manual ANALYSE on it the last_analyse statistic isn't being
update (I've waited enough time for it to be updated):

# SELECT * FROM pg_catalog.pg_stat_user_tables WHERE schemaname='s1' and
relname='t1';
   relid   |  schemaname  |  relname  | seq_scan |
seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del
| n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze |
last_vacuum |last_autovacuum| last_analyze |
last_autoanalyze | vacuum_count | autovacuum_count | analyze_count |
autoanalyze_count
---+--+---+--+--+--+---+---+---+---+---+++-+-+---+--+--+--+--+---+---
 237177743 | s1 | t1 |0 |0 |0 | 0 |
0 | 0 | 0 | 0 |   4820 |  0
|   0 | | 2023-11-03 13:34:23.725802+00 |
   |  |0 |1 | 0
| 0
(1 row)

But if I run a "SELECT * FROM s1.t1"  I see the seq_scan increase to 1 (as
expected) and after that I can issue a manual ANALYZE and the last_analyze
gets updated.

Is this behaviour normal? Are there some parameters that are verified that
prevent the ANALYSE from running?

Regards
-- 
Paulo Silva 


Postgresql crashing during pg_dump

2021-12-22 Thread Paulo Silva
Hello,

I have a huge table with 141456059 records on a PostgreSQL 10.18 database.

When I try to do a pg_dump on that table, postgresql gives a segfault,
displaying this message:

2021-12-22 14:08:03.437 UTC [15267] LOG:  server process (PID 25854) was
terminated by signal 11: Segmentation fault
2021-12-22 14:08:03.437 UTC [15267] DETAIL:  Failed process was running:
COPY ** TO stdout;
2021-12-22 14:08:03.437 UTC [15267] LOG:  terminating any other active
server processes
2021-12-22 14:08:03.438 UTC [15267] LOG:  archiver process (PID 16034)
exited with exit code 2
2021-12-22 14:08:04.196 UTC [15267] LOG:  all server processes terminated;
reinitializing
2021-12-22 14:08:05.785 UTC [25867] LOG:  database system was interrupted
while in recovery at log time 2021-12-22 14:02:29 UTC
2021-12-22 14:08:05.785 UTC [25867] HINT:  If this has occurred more than
once some data might be corrupted and you might need to choose an earlier
recovery target.

On the linux log I only see this:

Dec 22 14:08:03 kernel: postmaster[25854]: segfault at 14be000 ip
7f828fabb5f9 sp 7fffe43538b8 error 6 in libc-2.17.so
[7f828f96d000+1c2000]

I'm guessing I'm hitting some (memory?) limit, is there anything I can do
to prevent this? Shouldn't  PostgreSQL have some different behavior instead
of crashing the server?
-- 
Paulo Silva