Sir
Sir

Reputation: 8280

Improving efficientcy for loading big arrays

I was wondering the best way to load a big array which stores map data for creation in a canvas.

My two known options are:

Store each map tile in a database with each tile having an X : Y position stored. Query every row associated with the map in question then run through the loaded array to create the map.

OR

Create the array and store it in a single field. Then just load one row instead of 10,000 rows but have a huge pre-saved array stored like a massive string. And run through that array to create the map.

So the question is... 10,000 small rows or 1 big row - which is going to be more efficient/quicker and less intensive on server hardware?

Hope you can shed light on this, (or is there a third way? )

Upvotes: 1

Views: 172

Answers (2)

Cybercartel
Cybercartel

Reputation: 12592

When you have a map it's best way to store it is using a quadtree and a quadkey or you can use the spatial mysql extension. Basically a quadkey is a curve that completely fills the space and reduce the dimension complexity.

Upvotes: 1

Your Common Sense
Your Common Sense

Reputation: 157895

Well, the answer is quite simple.
Yet it is philosophical in a way.

If you are going to use a database. you have to store your data in a rows, to allow access to the every field.
If you are not going to use a database - do not use it at all.

Upvotes: 0

Related Questions