On Mon, Jun 13, 2011 at 6:51 AM, Ian Hardingham <i...@omroth.com> wrote:
> Hey guys, once again sorry for spamming at the moment. > > This is a simple question. > > My user account table has a field "isOnline INT". This table has, say, > 100,000 rows. > > Every ten seconds I need to compile a list of all users where isOnline is > 1. > > However, people log in and out at a rate of about 10 a second, so I'm > updating the account table 10 times a second. > > The question - should I put an index on isOnline or not? I'm very > worried about such an often-run transaction as logging in and out be as > fast as possible. > That depends on what fraction of entries have isOnline=1. If isOnline is rare, then an index might be helpful. But if roughly have the entires have isOnline=1, then an index will actually slow you down. It seems to me, though, that you are committing the classic error of premature optimization. Don't worry about indices at this point. Get you application running first. You can create and drop indices later, while the application is live, to see what effect, if any, indices have on performance. > > Thanks, > Ian > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users