Re: Getting interval in seconds?

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting interval in seconds?
Date: 2001-06-11 04:01:04
Message-ID: Pine.BSO.4.10.10106102359150.17529-100000@spider.pilosoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 10 Jun 2001, Lincoln Yeoh wrote:

> Thanks!
>
> Which is better/faster?
>
> select date_part('epoch',('now'::timestamp - somedate)::interval) from
> sometable;
>
> Or
>
> select extract (epoch from interval ('now'::timestamp - somedate)) from
> sometable;
Speedwise, I think its the same. _maybe_ the latter is faster, but I
wouldn't bet on it.

> Should I be using 'now'::timestamp or some function form of it?
No difference whether you use now() or 'now'::timestamp.

-alex

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2001-06-11 04:28:28 Re: something smells bad
Previous Message Alex Pilosov 2001-06-11 03:48:23 Re: Re: inserting, index and no index - speed