accumulated statistics

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: pgsql-hackers(at)postgreSQL(dot)org
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: accumulated statistics
Date: 1999-07-11 17:46:04
Message-ID: Pine.GSO.3.96.SK.990711212748.2043b-100000@ra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

I need accumulated hits statistics from my web appl. and it was looks easy
to implement.

Quick scenario:

1. create table hits (msg_id int4 not null primary key, hits int4);
2. in cgi script
update hits set hits=hits+1 where msg_id = $msg_id;

But this will not works if there are no row with msg_id,
so I need to insert row before. I could do this in application
but I suspect it could be done with rules.

before I dig into rules programming I'd like to know if somebody
has already have similar rule or is there another way to do this
in postgres. I'd prefer fast solution.

Regards,

Oleg

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-07-11 18:01:49 Re: [HACKERS] 6.5.1 CHANGES
Previous Message Oleg Bartunov 1999-07-11 17:27:22 create rule changes table to view ?

Browse pgsql-sql by date

  From Date Subject
Next Message qd 1999-07-11 20:43:03 Aggregates
Previous Message Tom Lane 1999-07-11 15:38:43 Re: [SQL] Re: [HACKERS] SELECT DISTINCT question