HI there,
I was just wondering what the recommended max size of a pnmodvar (the ones you create with pnmodsetvar) should be. I ask this becaue I have a module that stores a (serialised) config array as a modvar which could potentially become quite large... I have already noticed some overhead increase as the array beomes larger (not a lot, but noticable) - could this have adverse effects?
-Lobos
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment
- shyra posted »MenuTree Mystery« 19:50h
- dks answered »include a file« 18:22h
- dks answered ».764 -> 1.1.1, Can't add new blocks« 17:33h
- craigh posted »PostCalendar 5.5.0RC1 needs testers and translators« 17:24h
- bartl answered »Upgrading 1.0.2 --> 1.1.1« 15:02h
- Charlie-otb answered »SafeHTML output filter and youtube« 10:02h
- dl7und answered »Adding an "About Us" page« 03:34h
Login
pnmodvars - max size
-
- Rank: Professional
- Registered: 03.12.02
- last visit: 27.06.09
- Posts: 1572
-
- Rank: Professional
- Registered: 06.01.03
- last visit: 30.06.09
- Posts: 603
Since the value column for module variables is of type LONGTEXT, you should be able to store 64KB of text in it (which should be enough unless you have a really huge array).
In terms of overhead, this will certainly add some, however it's probably faster to do retrieve/update this in a single select/update rather than <n> (for however many elements you have) selects/updates. When in doubt, benchmark.
An alternative might be to serialize your array using delimeters (for example, "|") since this will shorted the amount of space required for the serialized array. However, this will only work for simple (1-dimensional) arrays and will require some custom code for (de)serialization ...
Greetings
--> R</n> -
- Rank: Professional
- Registered: 03.12.02
- last visit: 27.06.09
- Posts: 1572
Thank you for your advice.
-Lobos
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment -
- Rank: Professional
- Registered: 29.01.04
- last visit: 27.06.09
- Posts: 953
<smart ass="ass" remark="remark">
From: http://dev.mysql.com…-type-overview.html
Quote
LONGTEXT: A TEXT column with a maximum length of 4,294,967,295 or 4GB (2^32 – 1) characters. Up to MySQL 3.23, the client/server protocol and MyISAM tables had a limit of 16MB per communication packet or table row. From MySQL 4.0, the maximum allowed length of LONGTEXT columns depends on the configured maximum packet size in the client/server protocol and available memory.
I doubt that anyone would want to store anything that big in a modvar but it *is* possible.
</smart> -
- Rank: Professional
- Registered: 12.03.03
- last visit: 27.06.09
- Posts: 1181
<smart ass="ass" remark="remark" redeux="redeux">
What if all modules had similar large vars? Might make more sense to consider other ways of storing your module's variables.
</smart>
- Moderated by :
- Support
