Re: calculating elapsed times between timestamps

Поиск
Список
Период
Сортировка
От rhubbell
Тема Re: calculating elapsed times between timestamps
Дата
Msg-id 20090203083215.696791d2.Rhubbell@iHubbell.com
обсуждение исходный текст
Ответ на Re: calculating elapsed times between timestamps  (Scott Marlowe <scott.marlowe@gmail.com>)
Список pgsql-general
On Tue, 3 Feb 2009 02:08:54 -0700
Scott Marlowe <scott.marlowe@gmail.com> wrote:

> On Mon, Feb 2, 2009 at 5:54 PM, rhubbell <Rhubbell@ihubbell.com> wrote:
> >
> > I want to find the length of those intervals.
> >
> > select timestamp, timeelapsed, bobble from perf where bobble like "pokerflat"
> > and timeelapsed > 0.4;
> >
> > The records returned by that query will have an oldest and newest timestamp for
> > which I would like to calculate the interval.
>
> The easiest way is to just subtract one timestamp from another...  If
> you want the difference in seconds, then use extract
>
> select '2009-01-31 12:34'::timestamp - '2009-01-12 15:34'::timestamp;
>      ?column?
> ------------------
>  18 days 21:00:00
> select extract(epoch from '2009-01-31 12:34'::timestamp - '2009-01-12
> 15:34'::timestamp);
>  date_part
> -----------
>    1630800
>
> Does that get you closer to an answer?

Yes, thanks. I actually solved in a different way but this helps toward
understanding sql a little better. I think the s in sql is crippling.
I feel like I've traveled back in time whenever I use sql.
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: Text search, ERROR: invalid byte sequence for encoding "UTF8": 0xe9640a
Следующее
От: Alex Neth
Дата:
Сообщение: Re: Full text index not being used