This then begs the question of what happens when an update needs a bigger int? Doesn't that cause a fair bit more overhead than just keeping it 4 bytes? Fragging the database? I suppose for embedded use that might be important for most applications needing 2 bytes or less usually.
Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate ________________________________________ From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Igor Tandetnik [itandet...@mvps.org] Sent: Wednesday, February 09, 2011 3:19 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] EXT :Re: Bi-directional unique On 2/9/2011 4:13 PM, Black, Michael (IS) wrote: > And what's the advantage of packing like this? SQLite uses variable-length encoding for integers - smaller values (nearer to zero, to be precise) get packed into fewer bytes. So if you have two 1 values to store, combining them in the way Max Vlasov sugests would produce 2 (takes one byte in the database) rather than 0x00010001 (takes three, maybe four bytes). > So what if you're storing 0x00000001 and 0x00010000. > Same space No, not the same space. Whether the benefit is worth the complexity is a question, of course. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users