View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
15021 | Feature requests | Other | public | 2019-07-03 14:46 | 2021-03-07 21:08 |
Reporter | ollehar | Assigned To | c_schmitz | ||
Priority | none | Severity | feature | ||
Status | closed | Resolution | won't fix | ||
Summary | 15021: Use VIEW to cirumvent the database column limit | ||||
Description | One answer table can be split into multiple smaller tables and then merged in a VIEW. Example:
And then
A limitation:
Postgres might be stricter still:
Source: http://www.postgresqltutorial.com/postgresql-updatable-views/ This script shows that a VIEW has no limit on number of columns
BUT: Should be key/value store instead | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 8 | ||||
Story point estimate | |||||
Users affected % | |||||
@DenisChenu Thoughts? |
|
Arg … you mean development => database column by Question «object» I think more of something in config.xml Here i don't understand … |
|
Nothing like that. Instead of creating a table |
|
Ah OK … Personally : don't really like it … : because i don't see how to make it automatically inside Response model But don't have real better idea … Maybe : This not fix group with a lot of column … |
|
The Response model will be untouched. The only thing that changes is activate survey logic - instead of creating a table, it will create multiple tables and one view (if the columns are too many). |
|
All models will remain untouched. The response insert in EM will have to change, probably, to make sure a row in each table is inserted. |
|
Since EM use Response::model(sid)->save() in 4 : we can use model. I am surprised that the models of Yii can use the views without adaptation? My question is more : thi must be the most automatically possible and the most «soon» than possible. Since Yii DB access must be done by model : in my option it's better to use directly model update (and no another helper etc …). |
|
Ah crap, that will break. See this code above:
Can't insert into two tables at the same time via a view. D: |
|
Then : if break : need an update on Response::model too … Then need to know at what database THIS column refer … |
|
Yeah, the save() and update() methods need to be specially implemented. If we split by group it's easier to know which table to use. But it implies multiple queries for each save (possibly). Maybe not such a big difference, and only a performance hit if the number of columns is higher than allowed in one table. |
|
Another thing that can be done at the same time is changing the column name from sgqa to just qa (assuming survey id and group id are in the table name). This will save even more space. |
|
Yes, we can «easily» update column name But : if we update column name : maybe best is to use EM code for column name
BUT : this make table very more clear ;) |
|
I don't know if current 4.0 EM-Save update all values or only updated values ? |
|
If the column names are <questionid> or <questionid>_<answerid>, it will make sure there won't be any naming conflicts when creating the view. TODO: Check order question type answer columns.
That's up to Yii? If we do |
|
<questionid>[_<subYquestionid>][_<subXquestionid>] ? Currently <questionid>[<subYquestioncode>][_<subXquestioncode>] … But alt solution Make it easy to understand DB without LimeSurvey. I think there are a feature request by @Mazi about such column name. |
|
Updated desc above. It's possible to create a VIEW with 2'000 columns with large names (would not fit into one table; all columns have INT(1)). |
|
Right, subquestions... It's possible to have longer names like that, but it would limit nr of questions in one group (still OK, and maybe ID become very long too?). |
|
My last dev setup (less than one year : 13570 for last qid ;) ) |
|
Another solution : one table by question \o/ \o\ /o/ \o\ /o/ \o/ /o\ |
|
13k questions in one survey? |
|
Interesting approach. When using the VIEW we could even switch to more readable column names, see https://www.limesurvey.org/de/foren/development/105894-qcode-database-view#140098 Question is if it makes sense spending time on this when you are planning for more object orientated question modelling at LS 5 using inheritance and the like. Because that would be the step at which we should start splitting the old lime_survey_123456 tables into something like (just an example) And ideally we would be able to use question codes as column headings at the new design! |
|
It would be possible to create multiple views. One can even create a plugin that creates views that makes external reporting easier. :) |
|
@Mazi Are QCODES unique? |
|
@ollehar : for survey created after 2.05 yes. |
|
Yes, those codes should always be unique. |
|
@Mazi : it can be multiple with survey before 2.06 or 2.05 … |
|
Correct. When importing such surveys, codes get adjusted. So question is: What happens to duplicate or invalid (using e.g. underscores) codes if you do a DB update? |
|
Not with LSA if i remind : https://github.com/LimeSurvey/LimeSurvey/blob/387fe4d16f87675dd860cd46e1b74e856eef778d/application/models/Question.php#L168 |
|
Why would a db update change the content of the data? |
|
@ollehar, if you are updating a very old 2.00 version which uses duplicate question codes there can be issues if these codes don't get adjusted and you are using the codes as columns names. There could be two columns with name "age" for example. So such details would have to be checked and have to be adjusted. |
|
@Mazi, is there a bug report about any such issue? Or just personal experience? ;) |
|
@ollehar : current system us sidXgidXqid : then the issue can't happen Since we don't update question code : import joined LSA to check it :) |
|
Adding related issue 15035: Lost expression manager alert about deprecated question code |
|
@ollehar: As Denis pointed out, this can't happen with the current setup. But with the mentioned adjustments this, theoretically, could cause problems. I only pointed to that because before starting to develop something like that, we should consider the additional effort it may take to make sure codes are unique when updating from older versions or when importing old LSS/LSA files. |
|
Using views is not a solution since the number of fields that can be put into a join is also limited. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2019-07-03 14:46 | ollehar | New Issue | |
2019-07-03 14:48 | ollehar | Note Added: 52691 | |
2019-07-03 14:50 | ollehar | Description Updated | |
2019-07-03 15:07 | ollehar | Description Updated | |
2019-07-03 15:36 | ollehar | Description Updated | |
2019-07-03 15:46 | DenisChenu | Note Added: 52693 | |
2019-07-03 15:51 | ollehar | Note Added: 52694 | |
2019-07-03 15:56 | DenisChenu | Note Added: 52695 | |
2019-07-03 15:56 | DenisChenu | Note Edited: 52695 | |
2019-07-03 15:57 | DenisChenu | Note Edited: 52695 | |
2019-07-03 15:57 | DenisChenu | Note Edited: 52695 | |
2019-07-03 16:04 | ollehar | Note Added: 52697 | |
2019-07-03 16:05 | ollehar | Note Added: 52698 | |
2019-07-03 16:09 | DenisChenu | Note Added: 52700 | |
2019-07-03 16:32 | ollehar | Note Added: 52702 | |
2019-07-03 16:47 | ollehar | Description Updated | |
2019-07-03 17:42 | DenisChenu | Note Added: 52709 | |
2019-07-03 20:42 | ollehar | Note Added: 52719 | |
2019-07-04 16:35 | ollehar | Note Added: 52732 | |
2019-07-04 16:40 | DenisChenu | Note Added: 52733 | |
2019-07-04 16:42 | DenisChenu | Note Added: 52734 | |
2019-07-04 16:42 | DenisChenu | Note Edited: 52733 | |
2019-07-04 17:07 | ollehar | Note Added: 52735 | |
2019-07-04 17:18 | DenisChenu | Note Added: 52737 | |
2019-07-04 17:18 | DenisChenu | Note Edited: 52737 | |
2019-07-04 17:20 | DenisChenu | Note Edited: 52737 | |
2019-07-04 17:21 | DenisChenu | Note Edited: 52737 | |
2019-07-04 17:22 | DenisChenu | Note Edited: 52737 | |
2019-07-04 17:22 | DenisChenu | Note Edited: 52737 | |
2019-07-04 17:23 | DenisChenu | Note Edited: 52737 | |
2019-07-04 17:28 | ollehar | Description Updated | |
2019-07-04 17:29 | ollehar | Description Updated | |
2019-07-04 17:30 | ollehar | Note Added: 52739 | |
2019-07-04 17:31 | ollehar | Note Added: 52740 | |
2019-07-04 18:07 | DenisChenu | Note Added: 52741 | |
2019-07-04 18:32 | DenisChenu | Note Added: 52742 | |
2019-07-04 18:33 | DenisChenu | Note Edited: 52742 | |
2019-07-04 21:34 | ollehar | Note Added: 52743 | |
2019-07-04 21:37 | ollehar | Summary | Use VIEW to cirumvent the column database column limit => Use VIEW to cirumvent the database column limit |
2019-07-05 08:32 | Mazi | Note Added: 52745 | |
2019-07-05 11:30 | ollehar | Note Added: 52748 | |
2019-07-05 11:31 | ollehar | Note Added: 52749 | |
2019-07-05 11:40 | DenisChenu | Note Added: 52750 | |
2019-07-05 11:40 | DenisChenu | Note Edited: 52750 | |
2019-07-05 12:13 | Mazi | Note Added: 52756 | |
2019-07-05 12:36 | DenisChenu | Note Added: 52758 | |
2019-07-05 13:18 | Mazi | Note Added: 52760 | |
2019-07-05 14:28 | DenisChenu | Note Added: 52763 | |
2019-07-05 15:04 | ollehar | Note Added: 52765 | |
2019-07-06 17:19 | Mazi | Note Added: 52777 | |
2019-07-08 10:31 | ollehar | Note Added: 52782 | |
2019-07-08 10:41 | DenisChenu | File Added: survey_archive_brokenEMCode.lsa | |
2019-07-08 10:41 | DenisChenu | Note Added: 52783 | |
2019-07-08 10:50 | DenisChenu | Relationship added | related to 15035 |
2019-07-08 10:51 | DenisChenu | Note Added: 52784 | |
2019-07-08 10:59 | Mazi | Note Added: 52785 | |
2021-03-07 21:08 | c_schmitz | Assigned To | => c_schmitz |
2021-03-07 21:08 | c_schmitz | Status | new => closed |
2021-03-07 21:08 | c_schmitz | Resolution | open => won't fix |
2021-03-07 21:08 | c_schmitz | Note Added: 62823 | |
2021-03-07 21:08 | c_schmitz | Relationship added | related to 05289 |