pg.ddx.io pgsql-admin@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Database is slow, vacuum hangs 4+ messages / 2 participants [nested] [flat]
* Database is slow, vacuum hangs @ 2002-03-01 20:44 Nick Fankhauser <nickf@ontko.com> 2002-03-01 21:16 ` Re: Database is slow, vacuum hangs Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 4+ messages in thread From: Nick Fankhauser @ 2002-03-01 20:44 UTC (permalink / raw) To: pgsql-admin Hi- This morning, my database suddenly got very slow. I had been testing an import process, so I had loaded, deleted, and reloaded about 140MB of data several times. After the last reload, I noticed that the database was very slow. Queries that normally executed in seconds didn't return after several minutes. I don't know if they ever would have returned results, as I cancelled after about 5 minutes, so the database might have been completely locked. I decided to delete all of the data, do a vacuum, and then reload one more time. The deletes were slow, but worked, so the tables are all empty now. I started the vacuum and let it run for 4 hours while I did other work & it never came back. During this time, I noticed that two postmaster processes were constantly running- each taking up almost exactly half of the CPU time. There was no disk activity. After I canceled the vacuum, the two postmaster processes remained and continued to use all of the CPU time. (they're still there.) postgres.log doesn't contain any new messages. I guess the obvious next step is to restart postgres, but I don't want to blow away any evidence. Can anyone suggest tests I should do to learn what happened before trying a restart? I'm running PGSQL 7.1.3 on Debian Linux 2.4.14 Thanks- -Nick -------------------------------------------------------------------------- Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788 Ray Ontko & Co. Software Consulting Services http://www.ontko.com/ ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Database is slow, vacuum hangs 2002-03-01 20:44 Database is slow, vacuum hangs Nick Fankhauser <nickf@ontko.com> @ 2002-03-01 21:16 ` Tom Lane <tgl@sss.pgh.pa.us> 2002-03-01 21:47 ` Re: Database is slow, vacuum hangs Nick Fankhauser <nickf@ontko.com> 0 siblings, 1 reply; 4+ messages in thread From: Tom Lane @ 2002-03-01 21:16 UTC (permalink / raw) To: nickf@ontko.com; +Cc: pgsql-admin "Nick Fankhauser" <nickf@ontko.com> writes: > The deletes were slow, but worked, so the tables are all empty now. I > started the vacuum and let it run for 4 hours while I did other work & it > never came back. Is the vacuum actually running (accumulating any CPU time)? Or is it just waiting on a lock held by one of those other guys? > During this time, I noticed that two postmaster processes > were constantly running- each taking up almost exactly half of the CPU time. > There was no disk activity. After I canceled the vacuum, the two postmaster > processes remained and continued to use all of the CPU time. (they're still > there.) And what are they doing --- who started them, what query was sent to 'em, etc? If you haven't a clue, try attaching to each process with a debugger and printing out the global variable debug_query_string. regards, tom lane ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Database is slow, vacuum hangs 2002-03-01 20:44 Database is slow, vacuum hangs Nick Fankhauser <nickf@ontko.com> 2002-03-01 21:16 ` Re: Database is slow, vacuum hangs Tom Lane <tgl@sss.pgh.pa.us> @ 2002-03-01 21:47 ` Nick Fankhauser <nickf@ontko.com> 2002-03-01 22:12 ` Re: Database is slow, vacuum hangs Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 4+ messages in thread From: Nick Fankhauser @ 2002-03-01 21:47 UTC (permalink / raw) To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin > Is the vacuum actually running (accumulating any CPU time)? Or is it > just waiting on a lock held by one of those other guys? After a little blip at startup, it stops using CPU. Here's a snippet of the "ps": 21966 pts/0 S 0:00 /bin/sh /usr/lib/postgresql/bin/vacuumdb temp 21971 pts/0 S 0:00 /usr/lib/postgresql/bin/psql -c VACUUM -d temp 21972 ? S 0:00 postgres: postgres temp [local] VACUUM waiting > And what are they doing --- who started them, what query was sent to > 'em, etc? Here they are- they appear to be selects via JDBC initiated by Tomcat, but I can't think of a way to find out what the actual query was (the browser sessions are gone): 18980 ? R 193:28 postgres: www-data temp 127.0.0.1 SELECT 16093 ? R 197:05 postgres: www-data temp 127.0.0.1 SELECT > If you haven't a clue, try attaching to each process with a debugger and > printing out the global variable debug_query_string. How do I do that? Thanks, NickF ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Database is slow, vacuum hangs 2002-03-01 20:44 Database is slow, vacuum hangs Nick Fankhauser <nickf@ontko.com> 2002-03-01 21:16 ` Re: Database is slow, vacuum hangs Tom Lane <tgl@sss.pgh.pa.us> 2002-03-01 21:47 ` Re: Database is slow, vacuum hangs Nick Fankhauser <nickf@ontko.com> @ 2002-03-01 22:12 ` Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2002-03-01 22:12 UTC (permalink / raw) To: nickf@ontko.com; +Cc: pgsql-admin "Nick Fankhauser" <nickf@ontko.com> writes: >> If you haven't a clue, try attaching to each process with a debugger and >> printing out the global variable debug_query_string. > How do I do that? Having identified the process PIDs, you can do gdb /path/to/postgres-executable gdb> attach PID gdb> p debug_query_string gdb> bt -- might as well do this while you're here gdb> quit This assumes you have gdb handy. There is a way to do this with adb too, but I don't use it enough to remember. regards, tom lane ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-03-01 22:12 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2002-03-01 20:44 Database is slow, vacuum hangs Nick Fankhauser <nickf@ontko.com> 2002-03-01 21:16 ` Tom Lane <tgl@sss.pgh.pa.us> 2002-03-01 21:47 ` Nick Fankhauser <nickf@ontko.com> 2002-03-01 22:12 ` Tom Lane <tgl@sss.pgh.pa.us>
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