Re: [sqlite] Getting the location of a record in an Index

2011-09-09 Thread Ian Hardingham
Hey Igor, thanks for the reply. Is this O(1) ? Ian On 09/09/2011 13:21, Igor Tandetnik wrote: Ian Hardingham wrote: Again, I have: eloResultTable (id INTEGER PRIMARY KEY AUTOINCREMENT, player TEXT, elo FLOAT) with: CREATE INDEX IF NOT EXISTS eloResultScore ON eloResultTable (elo DESC) If

Re: [sqlite] Getting the location of a record in an Index

2011-09-09 Thread Simon Slavin
On 9 Sep 2011, at 1:47pm, Ian Hardingham wrote: > I really want O(1), but selecting by elo DESC and then setting a ranking > column for all records seems to be very slow, even during a transaction. Any > tips for doing that fast? If you're trying to collect this information for many different

Re: [sqlite] Getting the location of a record in an Index

2011-09-09 Thread Ian Hardingham
Thanks Igor. I really want O(1), but selecting by elo DESC and then setting a ranking column for all records seems to be very slow, even during a transaction. Any tips for doing that fast? Thanks, Ian On 09/09/2011 13:34, Igor Tandetnik wrote: Ian Hardingham wrote: Hey Igor, thanks for t

Re: [sqlite] Getting the location of a record in an Index

2011-09-09 Thread Igor Tandetnik
Ian Hardingham wrote: > Hey Igor, thanks for the reply. > > Is this O(1)? Or... I guess it's probably low-magnitude O(log n) ? It's O(n). There's no shortcut to count(*), it walks through and counts all the records satisfying the condition. A B-tree doesn't provide a fast way to obtain a numb

Re: [sqlite] Getting the location of a record in an Index

2011-09-09 Thread Ian Hardingham
Hey Igor, thanks for the reply. Is this O(1)? Or... I guess it's probably low-magnitude O(log n) ? Ian On 09/09/2011 13:21, Igor Tandetnik wrote: Ian Hardingham wrote: Again, I have: eloResultTable (id INTEGER PRIMARY KEY AUTOINCREMENT, player TEXT, elo FLOAT) with: CREATE INDEX IF NOT E

Re: [sqlite] Getting the location of a record in an Index

2011-09-09 Thread Igor Tandetnik
Ian Hardingham wrote: > Again, I have: > > eloResultTable (id INTEGER PRIMARY KEY AUTOINCREMENT, player TEXT, elo > FLOAT) > > with: > > CREATE INDEX IF NOT EXISTS eloResultScore ON eloResultTable (elo DESC) > > If I have the id of a row in eloResultTable, I wish to find how far down > the elo

[sqlite] Getting the location of a record in an Index

2011-09-09 Thread Ian Hardingham
Hey guys. (Thanks, I got my previous problem sorted). Again, I have: eloResultTable (id INTEGER PRIMARY KEY AUTOINCREMENT, player TEXT, elo FLOAT) with: CREATE INDEX IF NOT EXISTS eloResultScore ON eloResultTable (elo DESC) If I have the id of a row in eloResultTable, I wish to find how fa