Mi Yodeya is a question and answer site for those who base their lives on Jewish law and tradition and anyone interested in learning more. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm attempting to build a database with every pasuk in Tanach, I'm trying to determine the size of the varchar needed for this. Which pasuk is this and how many letters does it have?

share|improve this question
Do you count spaces? – Double AA Nov 23 '12 at 0:10
@DoubleAA I plan on making a torah codes program so I guess I need with and without – qwertymk Nov 23 '12 at 0:21

The verse in Tanach with the most words is Esther 8:9 (source) with 43 words:

ויקראו ספרי המלך בעת ההיא בחדש השלישי הוא חדש סיון בשלושה ועשרים בו ויכתב ככל אשר צוה מרדכי אל היהודים ואל האחשדרפנים והפחות ושרי המדינות אשר מהדו ועד כוש שבע ועשרים ומאה מדינה מדינה ומדינה ככתבה ועם ועם כלשנו ואל היהודים ככתבם וכלשונם: ‏

Since these words don't look so unusually short (and in fact contain one of the longest words in Tanach האחשדרפנים) and the next longest pasuk has only 41 words, I would guess this pasuk has the most letters as well, which by my count is 193 (235 if you count the spaces).

share|improve this answer

This doesn't answer your question, but in MySQL a varchar doesn't take extra disk space if you make it larger than necessary.

Are you storing in UTF-8, UTF-8-MB4, or 8859-8? The different types take different amounts of space. (3, 4, or 1 respectively, assuming you are using MySQL).

So you may just want to do varchar(65535) and not worry about it.

However if you anticipate lots of sorting operations the larger varchars do take extra temporary table space, which can slow things down. But if you sort via an index this is not a problem.

Hmm, I wonder if this is the wrong stackexchange site..... :)

Also, if your data source has nekudos the size depends on if you are storing the character composed or not. If they are not composed you need to double the space to account of the nekudos. (Although composed characters are somewhat preferred, so you should convert them.)

share|improve this answer
Well technically a varchar 65535 will take up one more byte than a varchar 255 but anyway my main concern is if I ever need to sort it will create a huge temp table – qwertymk Nov 23 '12 at 4:13
Yes, that is correct, but since UTF-8 Hebrew takes two bytes per char minimum (assuming no nekudos) I'm pretty sure you'd go over 128 characters, so you need the extra byte anyway. A temp table can be a concern, but are you really ever going to sort alphabetically by the first letter of a pasuk? Otherwise it's not going to be an issue. For bible-codes you need a totally different data structure, not strings. – Ariel Nov 23 '12 at 4:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.