On Wed, Jan 19, 2005 at 14:59:17 -0000,
  Mark Cave-Ayland <[EMAIL PROTECTED]> wrote:
>       BEGIN;
>       INSERT INTO person (first_name, .... Tel) VALUES ('Fred', ....
> '12345');
>       INSERT INTO person_count(id) VALUES (currval('id_seq'));
>       COMMIT;
> 
> 
> So then I would use SELECT COUNT(*) FROM person_count whenever I wanted to
> know the current number of person records. How much quicker would a COUNT(*)
> be if visibility were included in the indices as opposed to a "hacked"
> approach like this?

You are only going to get a constant factor speed up unless the space savings
allows much better use of cache. You probably want to look at using
triggers to maintain counts in another table.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to