Someone asked today on irc about grouping data, that contains timestamps, into "partitions". Usually when someone wants something like this, you can do grouping by date_trunc(), but this time, this person, wanted to group data that all timestamps are within given ...

Some time ago someone on irc asked interesting question. One that I couldn't answer then (didn't have an immediate idea, and didn't have time to spend on looking into it). Now, I have some more time, and despite the fact that ...

On 13th of April, Tom Lane committed patch: Provide moving-aggregate support for a bunch of numerical aggregates. First installment of the promised moving-aggregate support in built-in aggregates: count(), sum(), avg(), stddev() and variance() for assorted datatypes, though not for float4/float8. In passing, remove a 2001-vintage ...

And maybe not on the wall, but instead in your SQLz, eating your data. But a bit more seriously. Ever since PostgreSQL 8.4 we have window functions, but still I see people which do not know it or are wary to ...

Yesterday on irc someone asked: Hi, how do I get top 5 values from a column group by another column?? From further discussion, I learned that: total rows in table is 2 million. It'll have unique words of less than 1 million.. (approx ...

Couple of days ago I had a problem that I couldn't solve after ~ 2 hours, and decided to ask on IRC. Almost immediately after asking, I figured out the solution, but David asked me to write about the solution, ...

My jabber server had the feature, that it logs all messages that got sent through it. This is pretty cool, and useful. And now, i got asked to use it to create list of conversations. What exactly is this? Whenever I send ...

Let's imagine simple situation - you have table of objects (each with id), and you want objects 3, 71, 5 and 16. And in that order! How to do it?

I got asked this: having this table: # select * from a order by d; t | d ---+---- O | 1 O | 2 O | 3 M | 4 M | 5 M ...

One database that I am monitoring uses a lot of stored procedures. Some of them are fast, some of them are not so fast. I thought - is there a sensible way to diagnose which part of stored procedure take ...