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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2009-05-29 13:14:20 Re: pg_usleep() location
Previous Message Geoffrey 2009-05-29 13:06:12 Re: pg_usleep() location