On Thu, 2005-03-17 at 08:39 -0700, David Fletcher wrote: > >>>>> "DRH" == D Richard Hipp <[EMAIL PROTECTED]> writes: > > DRH> On Thu, 2005-03-17 at 06:32 -0500, D. Richard Hipp wrote: > >> I am proposing to limit the value of K to something like 2000. > >> > > DRH> Further study shows that in order to implement the > DRH> optimizations I have in mind, I'll need to limit the > DRH> number of columns in a single table to 1820. > > Out of curiosity, what code is affected? And, how did you arrive at > 1820? >
The code in question is VDBE opcodes MakeRecord and Operand found in the vdbe.c source file. These opcodes create and decode rows of data. At the beginning of each row is a variable-length integer which is the length of the "header". The header contains type information for the columns in that row. If I restrict the number of columns to 1820, then the size of the header can never exceed 16383. That value can always be encoded with a length integer of 2 bytes or less. Knowing that this variable-length integer is 2 bytes or less simplifies the encoding and decoding. -- D. Richard Hipp <[EMAIL PROTECTED]>