On 16 Sep 2009, at 3:23pm, Dmitry Konishchev wrote:

> Data in my program has such format that there is useful to place it in
> the database in many (thousands) columns.

It'll work, but SQLite does not use a balanced tree to store the  
columns for a particular record.  So if you're seeking the 700th  
column of a particular row, it has to look through 699 others before  
it gets to it.  Unless you always handle all the columns of a row  
together, it'll be slow.

Because of speed, and the difficulty of correctly handling such a long  
INSERT line, it's usually better to break this down into properties.   
So instead of

ID      prop1   prop2   prop3   prop4
--      -----   -----   -----   -----
1       rec1p1  rec1p2  rec1p3  rec1p4
2       rec2p1  rec2p2  rec2p3  rec1p4

Do

ID      propNumber      propValue
--      ----------      ---------
1       1               rec1p1
1       2               rec1p2
1       3               rec1p3
1       4               rec1p4
2       1               rec2p1
2       2               rec2p2
2       3               rec2p3
2       4               rec2p4

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to