Search Postgresql Archives

Re: Indexing queries with bit masks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike Christensen <mike@xxxxxxxxxxxxx> 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 Subscriptions, will this index be used in the above query?

No.  At least not with a standard btree index.

I'm not exactly sure that an index would be helpful at all --- it seems
like the selectivity of this condition won't be very good anyway, will
it?  The more popular notifications will be subscribed to by a large
fraction of the user base.  Maybe it'd be useful to index unpopular
notifications, but how often will you be searching for those?

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux