Skip site navigation (1) Skip section navigation (2)

optimize/cleanup SQL

From: Brandon Metcalf <brandon(at)geronimoalloys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: optimize/cleanup SQL
Date: 2009-05-29 13:13:32
Message-ID: Pine.LNX.4.58L.0905290807250.17654@cedar.geronimoalloys.com (view raw or flat)
Thread:
Lists: pgsql-general
For some reason this doesn't give me satisfaction that it's written
optimally, but I haven't found another way.

  SELECT round(CAST ((EXTRACT(EPOCH FROM clockout)
              -EXTRACT(EPOCH FROM clockin))/3600 AS NUMERIC),2) AS hours
    FROM timeclock;

The clockin and clockout columns are of type timestamp.

Is there a faster way to achieve this?  If not faster, a cleaner way
that executes as fast?


-- 
Brandon

Responses

pgsql-general by date

Next:From: Richard HuxtonDate: 2009-05-29 13:14:20
Subject: Re: pg_usleep() location
Previous:From: GeoffreyDate: 2009-05-29 13:06:12
Subject: Re: pg_usleep() location

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group