Re: [GENERAL] Rules, Windows and ORDER BY

2012-08-24 Thread Tom Lane
Martijn van Oosterhout writes: > On Fri, Aug 24, 2012 at 09:32:32AM +, Jason Dusek wrote: >> Why are the individual indices not useful? The tests that the >> query does -- equality on key and realm and ordering on at -- >> are each supported by indices. Does it have to do with the cost >> of l

Re: [GENERAL] Rules, Windows and ORDER BY

2012-08-24 Thread Martijn van Oosterhout
On Fri, Aug 24, 2012 at 09:32:32AM +, Jason Dusek wrote: > 2012/8/23 Tom Lane : > > Jason Dusek writes: > >> CREATE TABLE kv > >> ( k bytea NOT NULL, > >> at timestamptz NOT NULL, > >> realm bytea NOT NULL, > >> v bytea NOT NULL ); > >> CREATE INDEX ON kv USING hash(k); > >>

Re: [GENERAL] Rules, Windows and ORDER BY

2012-08-24 Thread Jason Dusek
2012/8/23 Tom Lane : > Jason Dusek writes: >> I have a simple table of keys and values which periodically >> receives updated values. It's desirable to keep older values >> but, most of the time, we query only for the latest value of a >> particular key. > >> CREATE TABLE kv >> ( k bytea NOT N

Re: [GENERAL] Rules, Windows and ORDER BY

2012-08-23 Thread Tom Lane
Jason Dusek writes: > I have a simple table of keys and values which periodically > receives updated values. It's desirable to keep older values > but, most of the time, we query only for the latest value of a > particular key. > CREATE TABLE kv > ( k bytea NOT NULL, > at timestamptz NOT

[GENERAL] Rules, Windows and ORDER BY

2012-08-23 Thread Jason Dusek
Hello List, I have a simple table of keys and values which periodically receives updated values. It's desirable to keep older values but, most of the time, we query only for the latest value of a particular key. CREATE TABLE kv ( k bytea NOT NULL, at timestamptz NOT NULL, realm bytea