|
Posted by The Natural Philosopher on 12/05/07 16:22
Mikhail Kovalev wrote:
> On 5 Des, 14:02, The Natural Philosopher <a...@b.c> wrote:
>> Mikhail Kovalev wrote:
>>> I unserialize an 8MB file, which contains the db array, and put the
>>> new element there (then serialize the whole thing again and store)
>> I am far from understanding what you are actually doing, but it sounds
>> like you are willing to trade disk usage for speed and memory usage.
>
> Yep, you nailed it right on through, my friend
>
> My question is, will I be able to access and store values by
> addresses?
essentially yes.
T
> Such as here:
> $database[33][NEXT][1221][NEXT][12][COUNT] += 1; for example
>
That would translate into a very large Mysql conditional statement, :
you might find it easier to split that into a series of separate
recursive calls into the SQL data base.. I have implemented something
like that..I have a data base of products that have a parent category,
and categories of categories..and so on.
I simply run a recursive subroutine that executes a single SQL statement
to walk all the tree branches.
All a database is, is an array of structures..called a table. Plus a set
of routines for accessing them.
Each structure is a row in the table, and can have a unique ID. This is
indexed by a hash by default.
Elements within the structure are the fields of the record. These can
also have indices associated with them.
To retrieve or update an individual record whose ID is known is
blindingly fast, but it sounds like you would need to search through
fields first to identify the one you want. That probably would mean
several recursive calls to the database and some attention to indexing
to get the best performance.
Navigation:
[Reply to this message]
|