473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

PostgreSQL seems to wait and block all the queries

HM
Hello !

-----------------------------------------------------------------------------
I would like to know why the database seems frozen.

- psql can access to database on the database server
- There are no error logs. There are only normal logs
- pgadmin cannot connect to the database.
- the webserver cannot execute any script
- other PHP scripts are waiting.

A lock seems to block all the database.
I've left the database as it is. I installed the database on an other
server to check the hardware of the old server.

IN ADVANCE THANK YOU !
-------------------------------------------------------------------------------

PostgreSQL 7.4.5 with "connect by" patch
Debian linux woody

The database is waiting and seems frozen.

1790 ? S 0:00 postgres: database database 192.168.1.8
SELECT
1791 ? S 0:00 postgres: database database 192.168.1.8
SELECT
1794 ? S 0:00 postgres: database database 192.168.1.8
SELECT
5559 ? S 0:00 postgres: database database 192.168.1.8
SELECT waiting
5980 ? S 0:00 postgres: database database 192.168.1.8
SELECT waiting
13449 ? S 0:00 postgres: database database 192.168.1.8
SELECT
18255 ? S 0:00 postgres: database database 192.168.1.8
SELECT waiting
18313 ? S 0:00 postgres: database database 192.168.1.8
SELECT waiting
29331 ? S 0:00 /USR/SBIN/CRON
29334 ? S 0:00 /bin/sh /script_vacuum
29337 ? S 0:00 /usr/sbin/sendmail -i -FCronDaemon -odi
-oem postgres
29339 ? S 0:00 /usr/bin/vacuumdb -z -f -v -U postgres
database
29340 ? S 0:00 /usr/sbin/postdrop -r
29341 ? S 0:00 postgres: postgres database [local] VACUUM
waiting
29350 ? S 0:00 postgres: database database 192.168.1.8
SELECT waiting
29358 ? S 0:00 postgres: database database 192.168.1.8
SELECT waiting
29362 ? S 0:00 postgres: database database 192.168.1.8
SELECT waiting

.... A lot of SELECT OR UPDATE waiting ...

Here is the result of select * from pg_stat_activity

datid | datname | procpid | usesysid | usename | current_query |
query_start
----------+----------+---------+----------+----------+----------------------------------------------------------------------
12777577 | database | 1790 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-05
18:00:55.032409+02
12777577 | database | 1791 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-05
18:00:56.185738+02
12777577 | database | 1794 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-05
18:01:01.294875+02
12777577 | database | 5559 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-05
18:47:38.033507+02
12777577 | database | 5980 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-05
18:52:08.089988+02
12777577 | database | 13449 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-05
20:51:12.717093+02
12777577 | database | 18255 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-05
22:08:17.587026+02
12777577 | database | 18313 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-05
22:09:07.963451+02
12777577 | database | 29350 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-06
04:15:09.556203+02
12777577 | database | 29358 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-06
04:15:22.681887+02
12777577 | database | 29362 | 100 | database | SELECT
price(ID) AS price FROM PRODUCTS WHERE ID=1 | 2004-10-06
04:15:27.485337+02

The problem happened at 04:15 AM during a vacuum FULL and could occurs
at every moment

Here is the result of select * from pglocks

relation | database | transaction | pid | mode |
granted
----------+----------+-------------+-------+------------------+---------
12777689 | 12777577 | | 1790 | AccessShareLock | t
20633160 | 12777577 | | 1790 | AccessShareLock | t
12777668 | 12777577 | | 1790 | AccessShareLock | t
| | 229273687 | 1790 | ExclusiveLock | t
12777773 | 12777577 | | 1790 | AccessShareLock | t
12777773 | 12777577 | | 1790 | RowExclusiveLock | t
12777689 | 12777577 | | 1791 | AccessShareLock | t
12777668 | 12777577 | | 1791 | AccessShareLock | t
20633160 | 12777577 | | 1791 | AccessShareLock | t
12777773 | 12777577 | | 1791 | AccessShareLock | t
12777773 | 12777577 | | 1791 | RowExclusiveLock | t
| | 229273691 | 1791 | ExclusiveLock | t
| | 229273699 | 1794 | ExclusiveLock | t
12777773 | 12777577 | | 1794 | AccessShareLock | t
12777773 | 12777577 | | 1794 | RowExclusiveLock | t
20633160 | 12777577 | | 1794 | AccessShareLock | t
12777689 | 12777577 | | 1794 | AccessShareLock | t
12777668 | 12777577 | | 1794 | AccessShareLock | t
12777689 | 12777577 | | 13449 | AccessShareLock | t
12777773 | 12777577 | | 13449 | AccessShareLock | t
12777773 | 12777577 | | 13449 | RowExclusiveLock | t
12777668 | 12777577 | | 13449 | AccessShareLock | t
| | 229354045 | 13449 | ExclusiveLock | t
20633160 | 12777577 | | 13449 | AccessShareLock | t
I would like to know if these functions and queries could cause
problems to postgresql.

This is a SELECT query of a field which is updated by a function in
the same query.

Example :

SELECT price(ID) AS price FROM PRODUCTS WHERE ID=1

function price(ID) - PL/SQL Function
{
IF TEST THEN RETURN get_price(ID)
}

function get_price(ID) - PL/Python
{
exec \'from urllib2 import *\' in globals(), locals()
url = "http://www.toto.com"
fichier = urlopen(url)

--
-- PARSE XML RETURNED BY toto.com
-- value = arbre.getElementsByTagName("test")[0].firstChild.data
--

UPDATE PRODUCTS SET price = value WHERE id=1

RETURN Value
}
Nov 23 '05 #1
3 8722
HM wrote:
I would like to know why the database seems frozen.
...
The problem happened at 04:15 AM during a vacuum FULL and could occurs
at every moment


VACUUM FULL locks your tables.
Nov 23 '05 #2
HM
Hello !

Thank you for your answer.

VACUUM FULL maybe lock tables but don't release them. It seems waits
an the release of an other lock in the database "database".
The database still frozen at this moment (2 days).

Here is a sample of VACUUM log
1 INFO: vacuuming "information_schema.sql_features"
2 INFO: "sql_features": found 0 removable, 360 nonremovable row
versions in 5 pages
3 DETAIL: 0 dead row versions cannot be removed yet.
4 Nonremovable row versions range from 68 to 208 bytes long.

....

796 INFO: index "pg_toast_16384_index" now contains 0 row versions in
1 pages
797 DETAIL: 0 index pages have been deleted, 0 are currently
reusable.
798 CPU 0.00s/0.00u sec elapsed 0.00 sec.
799 INFO: analyzing "pg_catalog.pg_attrdef"
800 INFO: "pg_attrdef": 4 pages, 63 rows sampled, 63 estimated total
rows

no more log from VACUUM

In the normal operation vaccum logs 2700 lines including vacuum log of
the database "database".

Bye

HM
William Yu <wy*@talisys.com> wrote in message news:<ck**********@news.hub.org>...
HM wrote:
I would like to know why the database seems frozen.
> ...
The problem happened at 04:15 AM during a vacuum FULL and could occurs
at every moment


VACUUM FULL locks your tables.

Nov 23 '05 #3
HM
Hello !

Thank you for your answer.

VACUUM FULL maybe lock tables but don't release them. It seems waits
an the release of an other lock in the database "database".
The database still frozen at this moment (2 days).

Here is a sample of VACUUM log
1 INFO: vacuuming "information_schema.sql_features"
2 INFO: "sql_features": found 0 removable, 360 nonremovable row
versions in 5 pages
3 DETAIL: 0 dead row versions cannot be removed yet.
4 Nonremovable row versions range from 68 to 208 bytes long.

....

796 INFO: index "pg_toast_16384_index" now contains 0 row versions in
1 pages
797 DETAIL: 0 index pages have been deleted, 0 are currently
reusable.
798 CPU 0.00s/0.00u sec elapsed 0.00 sec.
799 INFO: analyzing "pg_catalog.pg_attrdef"
800 INFO: "pg_attrdef": 4 pages, 63 rows sampled, 63 estimated total
rows

no more log from VACUUM

In the normal operation vaccum logs 2700 lines including vacuum log of
the database "database".

Bye

HM
William Yu <wy*@talisys.com> wrote in message news:<ck**********@news.hub.org>...
HM wrote:
I would like to know why the database seems frozen.
> ...
The problem happened at 04:15 AM during a vacuum FULL and could occurs
at every moment


VACUUM FULL locks your tables.

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Saleh, Amgad H | last post by:
The default block size which represents the page size is 8192 defined in pg_config.h.in. I've been trying to increase that to 16384 and rebuild postgreSQL. I was able to build it and it showed...
74
by: John Wells | last post by:
Yes, I know you've seen the above subject before, so please be gentle with the flamethrowers. I'm preparing to enter a discussion with management at my company regarding going forward as either...
44
by: Greg Strong | last post by:
Hello All, Is it better to create a query in DAO where a report has 4 sub-reports each of whose record source is a query created at runtime and everything is in 1 MDB file? From what I've...
0
by: Jerry LeVan | last post by:
Here is how I spent the last couple of days... Using aqua tcl/tk with postgresql seems to take a bit of extra work. With clues from Dan Steffen, I think I have it working... Here is the...
0
by: Mark Harrison | last post by:
HOWTO: Integrating Posgresql queries into an event loop. Mark Harrison mh@pixar.com May 27, 2004 Problem ------- The commonly used postgresql APIs will block until completed.
8
by: Kaarel | last post by:
Would PostgreSQL be a good enough choise for GnuCash (or Quickbooks or the likes) type of program? What could be the potential drawbacks of using PostgreSQL (perhaps its big size)? What would be...
5
by: Michał Gancarski | last post by:
Hello! How do one unescape strings prepared with pg_escape_string() ? stripslashes() will not work because both these functions are not completely compatible. Thank you all in advance --...
14
by: jptpjs via AccessMonster.com | last post by:
I have an application I built in Access 2003. It is an electronic medical records program split into front end (8 computers) and back end. This runs flawlessly. Purchased a billing program that...
10
by: Hendrik van Rooyen | last post by:
While doing a netstring implementation I noticed that if you build a record up using socket's recv(1), then when you close the remote end down, the recv(1) hangs, despite having a short time out...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.