Saturday, November 18th, 2006

8,388,608 books—sort of

Last night LibraryThing hit 8,388,608 books. That’s not books in LibraryThing—which stands at 7,268,540—but books ever in LibraryThing, including ones later deleted and some shadows. You might not think it, but 8,388,608 is a significant number. It’s half of 224, the largest number you can store in three bytes. It’s also the limit for MySQL’s “signed medium integer.” It’s 111111111111111111111111. The drawers are full of ones and there ain’t no twos.

Anyway, we hit the brick wall last night. I had previously expanded the book number field, but I forgot to change the databases that store some related metadata and reviews. So, last night, you couldn’t add a book, and this morning you couldn’t review one.

I’m really sorry about this. We’re good to go now. We won’t hit another wall until 8.4 billion books.

Interestingly, the same thing happend to Slashdot last week. Even Homer nods.

PS: I also fixed a bad problem with “search all fields.” Some queries ran quickly but some took ten or twenty minutes, by which time the user has generally gone on to better things (after re-running the query a dozen times which, let me tell you, doesn’t help much). It turns out MySQL was making periodic mis-guesses about which index to use. Somehow the index with eight million integers looked better than the one with a few hundred strings.

Labels: 1


Leave a Reply