Jump to content

Arrays as MySQL


silkfire

Recommended Posts

I read somewhere there was a class that allowed you to work with MySQL but instead of tables you get all your data into one array, then you can SELECT on that array.

 

The reason I'm asking I want to perform queries on this smaller set of data taken from a 10,000+ rows database which is slow. 1 query into the array takes 1 sec so that's fast.

 

I especially need sorting functions. In PHP you can only sort f.ex. by key or value, I want to multiple sort like in MySQL: ORDER BY age, name, id, score.

 

Throw your ideas at me ;) Just so you know I really want this array solution I don't want to hear any "optimize database/query" talk.

Link to comment
Share on other sites

If you have 10k rows in a mysql table, and you can't get a reasonable subset of the data in milliseconds, there is something wrong with your approach.  There are ways to performance tune the data.  In order to do anything with an array, you first have to read the entire contents into memory.  That is going to take a while. Yes arrays are hashed on their key, which is very efficient, and this is key, once the data is read into the array!  But that sort of efficiency already exists in the database, if you have normalized structures and have appropriate indexes and done explain on the queries, so that you are clear on how the queries are being optimized.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.