- Moderated by:
- Support Team
-
- rank:
-
Professional
- registered:
- December 2002
- Status:
- offline
- last visit:
- 24.08.08
- Posts:
- 1588
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 -
- rank:
-
Steering Committee
- registered:
- January 2003
- Status:
- offline
- last visit:
- 19.11.08
- Posts:
- 567
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:
- January 2004
- Status:
- offline
- last visit:
- 22.03.06
- Posts:
- 958
<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:
- March 2003
- Status:
- offline
- last visit:
- 13.08.06
- Posts:
- 1185
<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>
