Zikula: A Flexible Open Source Content Management System
home | forum | international support | contact us

Support Forum

Start ::  Developers Corner ::  Module Development ::  pnmodvars - max size

Moderated by: Support Team

Bottom
pnmodvars - max size

  • Link to this postingPosted: 12.12.2005, 17:44
    Profile Homepage
    Lobos
    rank:
    Professional 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
  • Link to this postingPosted: 12.12.2005, 19:13
    Profile Homepage
    rgasch
    rank:
    Steering Committee Steering Committee
    registered:
     January 2003
    Status:
    offline
    last visit:
    29.09.08
    Posts:
    563
    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>
  • Link to this postingPosted: 12.12.2005, 22:49
    Profile Homepage
    Lobos
    rank:
    Professional Professional
    registered:
     December 2002
    Status:
    offline
    last visit:
    24.08.08
    Posts:
    1588
    Thank you for your advice.

    -Lobos

    -----
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • Link to this postingPosted: 13.12.2005, 00:18
    Profile
    ainigma32
    rank:
    Professional Professional
    registered:
     January 2004
    Status:
    offline
    last visit:
    22.03.06
    Posts:
    958
    <smart ass="ass" remark="remark">

    From: http://dev.mysq...verview.html

    QuoteLONGTEXT: 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>
  • Link to this postingPosted: 23.12.2005, 20:30
    Profile Homepage
    Slugger
    rank:
    Professional Professional
    registered:
     March 2003
    Status:
    offline
    last visit:
    14.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>

Start ::  Developers Corner ::  Module Development ::  pnmodvars - max size

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to Zikula