Re: [sqlite] How to determine player's leaderboard rank efficiently?

2014-08-23 Thread Alessandro Marzocchi
1) Create data (now I use a script in python to create 10 millions rows with random data) test.py: import random import sqlite3 db=sqlite3.connect('players.db') c=db.cursor() c.execute("BEGIN") c.execute("CREATE TABLE player(name PRIMARY KEY, score REAL, rank INTEGER)") for i in range(1000):

[sqlite] How to determine player's leaderboard rank efficiently?

2014-08-23 Thread Tom
Hi, I have a table of players each with a score. I need to do 2 things: 1. select top n players sorted on score - this is easy, just select stuff order by score desc limit n. For efficiency, use an index on score. The top guy is rank 1, the next guy is rank 2, etc. I only need to do this once a

Re: [sqlite] -init file

2014-08-23 Thread Keith Medcalf
>> sqlite can be initialized using resource files. These can be combined >> with command line arguments to set up sqlite exactly the way you >> want >> it. Initialization proceeds as follows: >> >> o The defaults of >> >> >> mode= LIST >> separator

Re: [sqlite] -init file

2014-08-23 Thread jose isaias cabrera
"Giuseppe Costanzi" wrote... thanks Simon, stupidly I have used this, sqlite can be initialized using resource files. These can be combined with command line arguments to set up sqlite exactly the way you want it. Initialization proceeds as follows: o The defaults of

Re: [sqlite] -init file

2014-08-23 Thread Simon Slavin
On 23 Aug 2014, at 5:49pm, Giuseppe Costanzi wrote: > thanks Simon, > stupidly I have used this, I can see how you made that mistake. That way of showing defaults makes sense if you are reading many man pages one after another, but it's not the format that SQLite

Re: [sqlite] -init file

2014-08-23 Thread Giuseppe Costanzi
thanks Simon, stupidly I have used this, sqlite can be initialized using resource files. These can be combined with command line arguments to set up sqlite exactly the way you want it. Initialization proceeds as follows: o The defaults of mode=

Re: [sqlite] Insert optimization

2014-08-23 Thread Jean-Christophe Deschamps
How to improve the write speed then. I've found that in most cases using "chained" insertion speeds up things dramatically: insert into mytable (x, y, z) values (1, 2, 3), (4, 5, 6), (7, 8, 9), ... If you insert K rows at a time this way your total insert time can by cut by a significant

Re: [sqlite] -init file

2014-08-23 Thread Simon Slavin
On 23 Aug 2014, at 5:28pm, Giuseppe Costanzi wrote: > my file, setconsole > > headers = ON > mode= COLUMN > timer = ON Those commands are dot commands, not proper SQLite commands. They need to have dots in front of them. Also, having an equals sign there

[sqlite] -init file

2014-08-23 Thread Giuseppe Costanzi
HI all, I am trying to open an sqlite3 shell session passing a configuration file with the option -init but the console it doesn't shape my file, setconsole headers = ON mode= COLUMN timer = ON pep@hal9000:~/test/server$ sqlite3 -init setconsole test.db SQLite version 3.7.13 Enter

Re: [sqlite] Insert optimization

2014-08-23 Thread Simon Slavin
On 22 Aug 2014, at 7:08pm, Sherry Ummen wrote: > We have been trying out couchbase lite which uses sqlite underneath. > > I want to know how safe is use > PRAGMA synchronous = OFF"); > "PRAGMA journal_mode = MEMORY" > > I have been suggested not to use it but then its

[sqlite] Insert optimization

2014-08-23 Thread Sherry Ummen
Hello, We have been trying out couchbase lite which uses sqlite underneath. I want to know how safe is use PRAGMA synchronous = OFF"); "PRAGMA journal_mode = MEMORY" I have been suggested not to use it but then its soo dangerous then why is it thr in first place? It says the databse might

Re: [sqlite] Sqlite RTree nearest neighbour

2014-08-23 Thread skywind mailing lists
Hi Clemens, thanks for the link! Regards, Hartwig Am 22.08.2014 um 22:26 schrieb Clemens Ladisch : > skywind mailing lists wrote: >> I hoped that somebody already tried to implement a nearest neighbor >> algorithm. > > Typically, objects are not axis-aligned rectangles,

Re: [sqlite] Crash in sqlite3_mutex_try [Was: SQLite 3.8.6 beta]

2014-08-23 Thread Jan Nijtmans
2014-08-22 9:14 GMT+02:00 Jan Nijtmans : > It looks like this is on its way to being corrected: > > > However, I don't think this will work on Win95/98/NT Fixed here: Thanks! No more remarks! Regards, Jan