MySQL Forums
Forum List  »  Newbie

Re: Storing Array Data
Posted by: Phillip Ward
Date: August 30, 2016 05:23AM

Quote

What's the best way to store an array in MYSQL?
To rephrase the question:

"What's the best way to retrieve an array from MYSQL?"

And, as ever, the answer is "It depends".

Working backwards ...

What are you going to do with it once you've 'select'ed it?
If all you're going to do is send it back to the user intact, then keeping it together as a single unit is probably best. Why take it all apart if you're only going to put it all together again?

How are you going to "find" the data?

If you're going to run queries against the individual "bits" of that array, then the picture is completely different.
In that case, you have to pull the array apart and store it into rows, because that's far, far easier for your database to interrogate. Rummaging around "inside" string values is never going to perform well (because you can't use any indexes).

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
August 29, 2016 07:03AM
August 29, 2016 08:59AM
Re: Storing Array Data
August 30, 2016 05:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.