Re: [GENERAL] Indexing queries with bit masks

2010-05-02 Thread Mike Christensen
Hey thanks.. I thought I'd share the method I came up with for updating subscriptions. Basically, as far as my code is concerned the DB uses a bitmask (at least for updates) but I abstract it through a function. First off, I have a little helper function so I don't repeat the same code a bunch o

Re: [GENERAL] Indexing queries with bit masks

2010-05-01 Thread Filip Rembiałkowski
2010/4/30 Mike Christensen : > Ok I've been blatantly lying, err, purposely simplifying the problem for the > sake of the original email :) > > I've read over the responses, and am actually now considering just not using > any index at all.  Here's why: > > First, this actually isn't the only thing

Re: [GENERAL] Indexing queries with bit masks

2010-04-30 Thread Mike Christensen
Ok I've been blatantly lying, err, purposely simplifying the problem for the sake of the original email :) I've read over the responses, and am actually now considering just not using any index at all. Here's why: First, this actually isn't the only thing on the WHERE clause. It will only query

Re: [GENERAL] Indexing queries with bit masks

2010-04-30 Thread Peter Hunsberger
On Fri, Apr 30, 2010 at 11:29 AM, Tom Lane wrote: > Peter Hunsberger writes: >> If all subscriptions are roughly equal in popularity then any single >> select should give ~ 10% of the data.  That would seem to be selective >> enough that you'd really want an index? > > My personal rule of thumb i

Re: [GENERAL] Indexing queries with bit masks

2010-04-30 Thread Tom Lane
Peter Hunsberger writes: > If all subscriptions are roughly equal in popularity then any single > select should give ~ 10% of the data. That would seem to be selective > enough that you'd really want an index? My personal rule of thumb is that 10% is around the threshold where indexes stop being

Re: [GENERAL] Indexing queries with bit masks

2010-04-30 Thread Peter Hunsberger
On Fri, Apr 30, 2010 at 10:08 AM, Tom Lane wrote: > Mike Christensen writes: >> When a certain event happens, let's say event 4, I need to query for which >> users to notify.  So I'll be doing something like: > >> SELECT UserId FROM Users WHERE Subscriptions & 8; > >> My question is say there's a

Re: [GENERAL] Indexing queries with bit masks

2010-04-30 Thread Tom Lane
Mike Christensen writes: > When a certain event happens, let's say event 4, I need to query for which > users to notify. So I'll be doing something like: > SELECT UserId FROM Users WHERE Subscriptions & 8; > My question is say there's a million rows in the Users table. If I have an > index on