Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by hub.org (8.9.3/8.9.3) with ESMTP id NAA26160; Sun, 11 Jul 1999 13:46:15 -0400 (EDT) (envelope-from oleg@sai.msu.su) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.9.1/8.9.1) with SMTP id VAA02095; Sun, 11 Jul 1999 21:46:04 +0400 (MSD) Date: Sun, 11 Jul 1999 21:46:04 +0400 (MSD) From: Oleg Bartunov X-Sender: megera@ra Reply-To: Oleg Bartunov To: pgsql-hackers@postgreSQL.org cc: pgsql-sql@postgreSQL.org Subject: accumulated statistics Message-ID: Organization: Sternberg Astronomical Institute (Moscow University) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83