Postgres analyze takes time after upgrade 11.12 to 13.4 - postgresql

Issue:Analyze running for hours
I kept maintenance worker memory as 1 gb and maintenance workers as 4.DB Size is 40 GB
We upgraded postgres from 11.12 to 13.4.
Post upgrade, i am running analyze as below statement and i am seeing this job runs for hours.
(4 hours still running) .
Any input for this unusual long hours.
Note:
Command i used-> **VACUUM (VERBOSE, ANALYZE,parallel 4)**
Tracking via below statement:
select * from pg_stat_progress_analyze,From this table,I can see per second 250 blocks are scanned

Related

Upgraded RDS postgres from 11.16 to 14.4, CPU has been stuck at 100% for hours while running the huge aggregate queries

We have upgraded our AWS RDS Postgres from 11.16 to 14.4, After that I can see CPU stay around 100% for long hours while running the aggregate Queries.
I'm working with a large database. Most of the main tables have 1 million records. While running these aggregate queries in previous version (11.16) it will give the result without increasing the CPU usage.
Can we use ANALYZE command for optimizing the upgraded database?
Is there any impact when we running this command on database?
Any suggestions for resolving this?

PSQL On RDS Post upgrade to 14 ANALYZE VERBOSE is taking hours

Is there a way to speed up ANALYZE VERBOSE?
600GB database takes about 3 hours to run ANALYZE VERBOSE after upgrading to v14 on RDS.

citus write activity after ingestion is completed

I have a citus cluster of 1 coordinator node (32 vcores , 64 GB RAM) and 6 worker nodes (4 cores , 32 GB RAM each).
After performing ingestion of data using the following command where chunks_0 directory contains 300 files having 1M record each:
find chunks_0/ -type f | time xargs -n1 -P24 sh -c "psql -d citus_testing -c \"\\copy table_1 from '/home/postgres/\$0' with csv HEADER;\""
I notice that after the ingestion is done, there is still a write activity occurring on the worker nodes at smaller rate (was around 800MB/sec overall during ingestion, and around 80-100MB/sec after ingestion) for a certain time.
I'm wondering what is citus doing during this time?
If you do not run any queries in said time period, I do not think Citus is responsible for any writes. It's possible that PostgreSQL ran autovacuum. You can check the PostgreSQL logs in the worker nodes and see for yourself.

Postgres Analyze Command took 1 hour 30 mins for single table on moderate size RDS

Issue: Postgres one table took 1 hour 30 mins just to analyze for default statistics target of 100.
Why?
How we can predict this time in future?
Is there any way to speed it up for such tables
Current Setup:
Postgres version: 12.4
Fresh instance restored from snapshot on AWS and then upgraded to 12.4
VCPU: 4
RAM: 16 GB
IOPS:3000
Relation size: 23 GB
Relation total size: 139 GB
Table Size: 83 GB
reltuples: 1.21582e+07
Is it because of large size of toast?
No, this is not normal.
Unless your system is very, very slow, the problem was probably an ACCESS EXCLUSIVE lock that someone had taken on the table and never released.

Postgres uses High CPU - unable to find

I'm having Postgres 9.6.4 in Ubuntu 17. After every few hours (say 6 hours or so), the OS CPU utilization becomes very high (upto 98% or more).
I did the following:
# ps aux | grep postgres
Whenever the process/CPU is high, the above command shows postgres processes like this:
31928 1 ./x3665600000 0.2 99.8
The process name with x3665600000 always consumes near to 100% CPU.
When I checked the pg_stat_activity table, it shows SQL query like this:
select Fun310280 ('./x3665600000 &')
select Fun310280 ('./ps3657178651 &')
What is this function causing Postgres to use very high CPU?