Re: playing with timestamp entries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dale(at)icr(dot)com(dot)au
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: playing with timestamp entries
Date: 2001-04-25 21:57:55
Message-ID: 10252.988235875@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dale Walker <dale(at)icr(dot)com(dot)au> writes:
> I use the 'hash' type as queries regarding usage will always be of the
> form "select ...... where username='xxx';"

Use a btree anyway. Postgres' btree implementation is much better than
its hash index implementation.

> insert into sumlog
> select s.username,
> to_char(timestamp(h.time_stamp),'YYYY-MM') as date,
> sum(h.acctsessiontime),
> sum(float8(h.acctinputoctets)/1000000),
> sum(float8(h.acctoutputoctets)/1000000)
> from subscribers as s,history as h
> where s.username=h.username
> group by s.username,date;

> This works fine, but as the database size is constantly growing the
> summary table takes a while to calculate...

What plan does EXPLAIN show for this query?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dale Walker 2001-04-25 22:13:04 Re: playing with timestamp entries
Previous Message Dale Walker 2001-04-25 21:23:19 playing with timestamp entries