powa-team / powa-archivist

powa-archivist: the powa PostgreSQL extension
http://powa.readthedocs.io/
PostgreSQL License
52 stars 20 forks source link

Powa causes unexpected sever closure #1

Closed galeone closed 8 years ago

galeone commented 8 years ago

Hi, before powa installation the query

SELECT COUNT(counter)     AS cc FROM users  WHERE viewonline IS TRUE AND last > (NOW() - INTERVAL '4 MINUTES');

works without any problem.

Here's a explain verbose output of the query (maybe it can be helpful):


 Aggregate  (cost=180.28..180.29 rows=1 width=8)
   Output: count(counter)
   ->  Seq Scan on public.users  (cost=0.00..180.28 rows=1 width=8)
         Output: counter, last, notify_story, private, lang, username, password, name, surname, email, gender, birth_date, board_lang, timezone, viewonline, remote_addr, http_user_agent, regis
tration_time
         Filter: ((users.viewonline IS TRUE) AND (users.last > (now() - '00:04:00'::interval)))
(5 rows)

After powa installation, the same query output is:

server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

In addiction, application connected to postgres have logs full of this error: (here's an example of a php application, conneted via PDO to postgresql).

 {main}: SQLSTATE[08006] [7] FATAL:  the database system is in recovery mode

Disabling powa (commenting out the 4 lines below) everything comes back to the original state, and everything works well.

shared_preload_libraries='pg_stat_statements,powa,pg_stat_kcache,pg_qualstats'
powa.frequency = 10min
powa.retention = 1d
powa.database = powa
powa.coalesce = 100

I found powa really helpful (tuning the DB its so much easier now) thus I hope you can fix this issue ASAP, so I can re-enable it on my server and continuing the tuning.

Thank you.

P.S: if you want the schema structure (the schema on which I run the query above) you can find it here: nerdz-test-db

My PostgreSQL server version is: 9.4.4

Thank you

rdunklau commented 8 years ago

Hi !

The bug you are experiencing is not present in the latest release of pg_qualstats (0.0.6). It has been introduced on the master, not yet released, branch, but has been corrected in the "devel" branch which should be merged (and released!) soon.

So, either use the devel branch (not recommended) or install a stable, released version (recommended).

Thank you !

galeone commented 8 years ago

Hi, thank you for the quick reply.

I'm going to follow the [official guide](https://powa.readthedocs.org/en/latest/stats_extensions/pg_qualstats.html] to setup pg_qualstats) instead of follow only the quick-start guide (as I did, thus I encountered this problem).

You can close the issue if you want.

Thank you