On Mon, 20 Jun 2005, Yuriy wrote: >Hello sqlite-users, > >Sqlite low level and Speed. > >Sorry for my bad English. > >I try use Sqlite for Operation FAST grouping strings (delete duplicates) > >I have input array of strings > >String1 >String2 >String3 >String1 >String2 >??? >StringN > > >Need delete dublicates. > >Output database >String1 >String2 >String3 >??.. >StringN > >1. Example of the decision > >CREATE TABLE testtable (val text) >CREATE INDEX index_val ON [testtable]([val]);
When creating testtable, specify val as unique, and specify what to do with conflicts: CREATE TABLE testtable(val TEXT UNIQUE ON CONFLICT REPLACE); The conflict clauses are documented here: http://www.sqlite.org/lang_conflict.html Note, the following does not work as expected (as I expected, at least!) CREATE TABLE testtable (val text); CREATE INDEX index_val ON testtable(val) ON CONFLICT REPLACE; The conflict clause appears to be ignored. >PRAGMA synchronous = OFF; > >for i:=1 to 10000000 do >begin >select * from testable where val=StringN >if val NOT Exist insert into testtable >end > >Very Slow. > >2. Example of the decision > > >CREATE TABLE testtable (val text,hashval integer) >CREATE INDEX index_hashval ON [testtable]([ hashval]); >PRAGMA synchronous = OFF; > >for i:=1 to 10000000 do >begin >select * from testable where hashval=hash(StringN)and(val= StringN) >if val NOT Exist insert into testtable >end > >Very Slow. > > >3. Example of the decision > >I find good example for SQLite Low level functions SQlite VS BDB. > >http://rganesan.blogspot.com/ > >But this example use such functions as > >sqlite3BtreeOpen >sqlite3BtreeInsert >sqlite3BtreeCursor > >I Use Windows and Delphi. In the SQlite3.dll no import this functions. > >Please Help me. May be need recompile sql I Have Visual C++ and C++Builder >If need recompile as make it is on Windows Platform? The Btree functions are internal to SQLite and subject to change without notice. Hence they are not exported. If you want access to such functions, you must compile your own library exporting the functions on Windows, and fix problems in the future if this API changes at all. > >May be present other decision this problem? Need more speed for grouping >big arrays of strings Group them by what criteria? How about just using an aggregate select or group by? > >Thanks you. > Christian -- /"\ \ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \