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
- mercromina responded to »error when i try to upgrade to the last version of dizkus module (3.1)« 08:01 PM
- craigh responded to »TagIt 3.0 for Zikula« 03:58 PM
- localrags responded to »Remove contents of nuke_sc_anticracker from Database« 11:30 AM
- jmvaughn responded to »Shoutit for zikula 1.3?« 09:31 AM
- mdee responded to »Different page content under one template (tpl file) based on URL« 07:17 AM
- espaan responded to »Categories disappear when editing ...« 08. Feb
- eledril responded to »How decrease zikula cpu usage« 08. Feb
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
pnmodvars - max size
-
- Rank: Expert
- Registered: Dec 02, 2002
- Last visit: Apr 30, 2010
- Posts: 1474
-
- Rank: Team Member
- Registered: Jan 05, 2003
- Last visit: May 28, 2010
- Posts: 766
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: Expert
- Registered: Dec 02, 2002
- Last visit: Apr 30, 2010
- Posts: 1474
Thank you for your advice.
-Lobos
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment -
- Rank: Helper
- Registered: Jan 29, 2004
- Last visit: Oct 21, 2009
- Posts: 852
<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: Expert
- Registered: Mar 11, 2003
- Last visit: Oct 21, 2009
- Posts: 1104
<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
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
