Today development found me, said their database connection is not up, may be too many connections, and then I log on to the server, and try to log into the database, is also an error:Psql:FATAL:sorry, too many clients alreadyIt is clear that the
Postgresql 8.3.3
Today the application reflects the database is very slow, some of the SQL execution day did not finish,Check the database, found that a large number of sessions in the update the same table tbl_tmp, resulting in a large number of
S skills, Postgres skills
If you need to add indexes when the business volume is large, you need to use CONCURRENTLY. Otherwise, your database will easily break down.
For example
create index CONCURRENTLY idx_order_records_bank_statist_uid on
One, to see which users are linked to the databaseSelect from Pg_stat_activity;The pg_stat_activity here is actually a view, and its definition can be found in the View section of the Postgres database.Second, kill the process now we find all the
Query the selecta lock in the table. locktype,. database,. pid,. mode,. relation, B. relnamefrompg_locksajoinpg_classbona.relationb.oidwhereupper (B. relname) #39; TABLE_NAME #39; the above is query... query the locks in the table.
select
Original Sticker Address: https://www.oschina.net/translate/showdown-mysql-8-vs-postgresql-10?lang=chs&page=2#English Original address: http://rachbelaid.com/introduction-to-postgres-physical-storage/Now that MySQL 8 and PostgreSQL 10 have been
Description of PostgreSQL lock query and killing Process
Query the locks in the table.
Select a. locktype, a. database, a. pid, a. mode, a. relation, B. relname
From pg_locks
Join pg_class B on a. relation = B. oid
Where upper (B. relname) = 'table _
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.