Total number of answers and subquestions supported by LS

More
3 months 2 weeks ago #157278 by jackuars
jackuars created the topic: Total number of answers and subquestions supported by LS
Once I got an error that I exceeded the number of subquestions that can be created in a survey. I forgot how much it was, but I'm afraid this time I'm creating a survey that has more than 2500 answer options in total. Is this possible?

Please Log in to join the conversation.

More
3 months 2 weeks ago - 3 months 2 weeks ago #157282 by LouisGac
LouisGac replied the topic: Total number of answers and subquestions supported by LS
all the questions/subquestions/answers are added as columns in the survey_{sid} table.
In MySQL 5.7, the max number of columns is 4096. Knowing that few columns are used for core stuff (like id, IP adress, etc ), it should be possible to go up to 4000 answers.
dev.mysql.com/doc/refman/5.7/en/column-count-limit.html

But, the maximum row length can't exceed 65,535 bytes, so it also depends on the question types you're using. Free text: no problem, it's a text field not stored in the db. For other question types:
github.com/LimeSurvey/LimeSurvey/blob/ma...helper.php#L278-L388

they are using the Yii types, that are converted to MySQL/postgresql/mssql types:
channaly.wordpress.com/2012/02/02/list-o...pe-in-yii-migration/

For example, 5 Point Choice or Gender or YesNo use string(1). Yii String(1) in MYSQL become varchar(1), which is one byte:
github.com/LimeSurvey/LimeSurvey/blob/ma...vate_helper.php#L333

So, knowing that few columns are used by default for each survey (like "id", or "ipadress", etc), if you used only 5 point choice question, you should be able to add around 4050 questions.

But, if you're using list radio, or multiple choice, without comments:
github.com/LimeSurvey/LimeSurvey/blob/ma...vate_helper.php#L312

It creates a Yii string(5), which in MYSQL become a varchar(5), so the maximum number of answers in a survey using only those question types would become something near: 65,535 bytes / 5 bytes, so something near 13000 answers/subquestions (but if using comments, it becomes a MySQL text field, so the limitation is removed :side: ).

etc etc

So, there is no real answer to your question, it depends on the question types / options you're using.
Last Edit: 3 months 2 weeks ago by LouisGac.

Please Log in to join the conversation.

More
3 months 2 weeks ago #157283 by LouisGac
LouisGac replied the topic: Total number of answers and subquestions supported by LS
also, for what I've seen until now, each time users reached this limit it was because multiple surveys were inside a single survey, and the user was then directed to a survey or another after answering to a question. That's not the best way to do. You can reach this goal by different ways, like for example a mini survey + redirection to the wanted survey at the end of it. Maybe that tip can help you.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!