Some time ago I wrote about getting fast pagination. While fast, it had some problems which made it unusable for some. Specifically - you couldn't get page count, and easily jump to page number N. I did some thinking on the ...
May 13th, 2010 by depesz | Tags: changes, count, lag, nullif, postgresql, rank, tnt, window functions | 3 comments »
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 ...
Let's assume you have very simple table with users: # \d users Table "public.users" ...
May 22nd, 2008 by depesz | Tags: count, distinct, group by, performance, postgresql, surprise | 2 comments »
When I was working for one of customers we found some strange thing. We needed to found number of distinct sessions per day. Table layout was very simple:
