Jump to content

Recommended Posts

I'm working on a fairly ambitious project and have a HUGE set of array values to store, edit, and call from the database. This is a general question in regards to the best way to do this. To give you an example of the size:

 

$tile[-33][423] = "green"
$tile[-99][-300] = "green"
$tile[1000][30] = "brown"
$tile[9][-1] = "red"
$tile[10939][-2] = "brown"

and so on...

 

There will possible be millions of variable array combinations here.

 

I was first thinking about serializing the array to store in a single field on the database. But the problem comes in when I want to edit a single tile variable, I would have to grab all the data (I think?), change one thing, put it all back - that would be pretty resource intensive, especially when I would need to make these edit calls 10 times a minute for example.

 

So that leaves me to the only other option I can think of, which is doing a column and row approach:

 

x

y

tile

100

5000

red

-211

7120

green

455

2

blue

and so on...

 

But then I thought, what is the performance going to be like if go to import 5000 variables into the database in one fell swoop? Or what about when I need to grab the data from 5000 of them to output? Maybe it won't be so bad? The SELECT, INSERT functions for these 5000 variables won't be happening near as much as the single UPDATE calls, but they could still be fairly frequent - perhaps once every 10 minutes for the INSERT, once every 2 minutes for the SELECT. Hopefully that made some sense.

 

Also, am I going to be running into any PHP/MySQL limitations here on int values, or array limits?

Link to comment
https://forums.phpfreaks.com/topic/226691-large-php-array-database-management/
Share on other sites

  • 2 weeks later...
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.