Req #62278 [NEW]: Data structure optimized for table data
| From: | jasonmoo at me dot com | Date: | Sat, 09 Jun 2012 16:03:03 +0000 |
| Subject: | Req #62278 [NEW]: Data structure optimized for table data | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-171169@lists.php.net to get a copy of this message | ||
From: jasonmoo at me dot com
Operating system:
PHP version: Irrelevant
Package: *Programming Data Structures
Bug Type: Feature/Change Request
Bug description:Data structure optimized for table data
Description:
------------
Hey. So it's not uncommon for a website to cache large database record
sets in
redis/memcache/etc and pull it out, filter it down, and present the
remainder.
However using an array of arrays has memory and speed disadvantages due to
allocating more array buckets than needed and storing column names in every
key
of every row.
I'm requesting an SPL data structure that would reduce memory and increase
access time on large record sets.
A recordset object could be initiated with an array of column names and
optional
row count. Records could be added/removed but each row would be an
arrayobject-
like object reflecting the column array. However this object could store
the
data as a simple array and reference the recordset for a column's location
in
that array.
Initiating recordsets/records with counts gives the advantage of only
allocating
as much array buckets as needed. And only storing the column names in the
recordset object removes the need to store and hash each column name on
each
record.
The memory savings on larger sets should be significant as well as a nice
speed
boost.
If this was adopted, making it available as a native structure in the *sql
drivers would reduce the overhead on actually getting it out of the
database to
begin with. And a nice serialized format would reduce it's memory
footprint in
memcache/redis/etc as well.
This is my first submission for a feature request, while I've been a php
dev for
~12 years.
Thanks!
Jason
--
Edit bug report at https://bugs.php.net/bug.php?id=62278&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62278&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62278&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62278&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62278&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62278&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62278&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62278&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62278&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62278&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62278&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62278&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62278&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62278&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62278&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62278&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62278&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62278&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62278&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62278&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62278&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62278&r=mysqlcfg