optimize/cleanup SQL - Mailing list pgsql-general

From Brandon Metcalf
Subject optimize/cleanup SQL
Date
Msg-id Pine.LNX.4.58L.0905290807250.17654@cedar.geronimoalloys.com
Whole thread Raw
Responses Re: optimize/cleanup SQL
Re: optimize/cleanup SQL
List 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

pgsql-general by date:

Previous
From: Geoffrey
Date:
Subject: Re: pg_usleep() location
Next
From: Richard Huxton
Date:
Subject: Re: pg_usleep() location