CS> When creating testtable, specify val as unique, and specify what to do CS> with conflicts: CS> CREATE TABLE testtable(val TEXT UNIQUE ON CONFLICT REPLACE); CS> The conflict clauses are documented here: CS> http://www.sqlite.org/lang_conflict.html Try it for ~1,000,000 UNIQUE records very slow :( and me need allso count this UNIQUE records. now i try keep count in the memory.
slDBPath := ExtractFilepath(application.exename)+ 'test.db'; sldb := TSQLiteDatabase.Create(slDBPath); sldb.execsql('PRAGMA synchronous = OFF;'); sSQL:='CREATE TABLE testtable(val TEXT UNIQUE ON CONFLICT REPLACE);'; sldb.execsql(sSQL); // sSQL:='CREATE TABLE testtable (val text);'; // sldb.execsql(sSQL); // sSQL:='CREATE INDEX index_val ON testtable(val) ON CONFLICT IGNORE;'; // sldb.execsql(sSQL); GlobalTimer:=Now(); sldb.BeginTransaction; Randomize; c:=0; sSQL := 'INSERT INTO testtable(val) VALUES (?);'; if Sqlite3_Prepare(sldb.fDB, PChar(sSQL), -1, Stmt, NextSQLStatement) <> SQLITE_OK then begin ShowMessage('Error executing SQL') end; for i:=1 to 1000000 do begin ip:=IntToStr(random(255))+'.'+IntToStr(random(255))+'.'+'.'+IntToStr(random(255))+'.'+IntToStr(random(255)); sqlite3_bind_text(Stmt,1, PChar(ip),Length(ip),nil); Sqlite3_step(Stmt); SQLite3_Reset(Stmt); inc(c); if c=10000 then begin sldb.Commit; sldb.BeginTransaction; c:=0; end; end; sldb.Commit; sldb.Free; CS> If you want access to such functions, you must compile your own library CS> exporting the functions on Windows, and fix problems in the future if this CS> API changes at all. Can do this on Visual C++ May be have examples? Or steps? CS> Group them by what criteria? How about just using an aggregate select or CS> group by? No if table have more 1,000,000 very slow grouping But i my case heave ONE big table and one small grouping table mini OLAP :) -- Best regards, Yuriy mailto:[EMAIL PROTECTED]