On Thu, Aug 4, 2016 at 8:29 AM, Dominique Devienne <ddevie...@gmail.com> wrote:
> On Thu, Aug 4, 2016 at 5:05 PM, Kevin O'Gorman <kevinogorm...@gmail.com> > wrote: > > > 3. Positions are 64 bytes always, so your size guesses are right. They > are > > in no particular order. I like the suggestion of a separate position > > table, because they're going to appear in multiple qmove records, with an > > average of about 3 or 4 appearances I think. Maybe more. > > > > 3x or 4x duplication doesn't sound like a lot. What you'd gain in the moves > table, > you'd lose having to join to the positions table I suspect. Higher level > duplicates, maybe. > > 64-bytes always? Is that a human readable string, or some 'code' in > hexadecimal? > If the latter, use a blob, which requires only 32-bytes to store the same > info. You can > use the blob literal notation x'abcdef01' (that's a 4-bytes blob). > It's even less dense than that. Each character has only 3 possible values, and thus it's pretty easy to compress down to 2 bits each, for a 16 byte blob. It's just hard to do that without a bunch of SQLite code I'd have to learn how to write. The current effort amounts to a feasibility study, and I want to keep it as simple as possible. > Finally, note that if your program writes a huge text file with all your > values, that you > .import into sqlite3 as you showed, you're IMHO wasting time, since you > can't use > prepared statements and binds, and you also force SQLite's SQL parser to > parse > a huge amount of text. By embedding SQLite into your generator program, you > remove all parsing except for a trivial "insert into qmoves values (:1, :2, > ...)", and > all the rest is sqlite_bind*() and co. calls. (and if blob situation for > positions, then > you can bind the 32-bytes blob directly, no need to convert/parse to/from > hex). > I understand the concept of prepared statements in principle, sort of, don't how binds work really, so I'm not quite ready to write the code you allude to. And I'd no longer be able to use sqlite3 at all to do simple experiments -- I'd have to be blobbing and de-blobbing to make sense of anything. > > My $0.02. --DD > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > -- #define QUESTION ((bb) || (!bb)) /* Shakespeare */ _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users