[development] Do not let postgresql hold back great patches
kb at 2bits.com
Mon Dec 3 23:42:56 UTC 2007
On Dec 3, 2007 1:49 AM, Larry Garfield <larry at garfieldtech.com> wrote:
> As for in-SQL operations on the date value, like MONTH() or YEAR() in
> If someone has an idea for those that doesn't involve regexing every query
> would dearly love to hear it. :-)
The current use of UNIX timestamp is a compromise, and has its issues, but
still allows in-SQL operations.
In-SQL operations is very very important. Going to ActiveRecord type of
abstraction without the ability to do aggregate operations on the data is
just not an option.
Without in-SQL, doing things like:
select n.nid, n.type, n.title, count(*) as num_votes, avg(value) as avg_vote
from votingapi_vote v inner join node n on content_id = n.nid where n.type =
'image' and n.created between unix_timestamp('2007-11-01 00:00:00') and
unix_timestamp('2007-11-30 23:59:59') group by v.content_id having num_votes
> 1 order by avg_vote desc, num_votes desc limit 20;
Would be impossible, or would entail very expensive full table scans.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the development