4 comments

1

Thumbnail is bad for 3 reasons:

  1. The 'php' should be lowercase
  2. That XML-style end tag is plain wrong; it should end with ?>
  3. ...or not at all; the best practice is to leave the <?php open at the end of file since it prevents accidental data being sent in included scripts (thus triggering the HTML headers being sent)

Also consider MariaDB instead.

1

How well does 10.2 handle JSON data? That's been one thing that I could use that MariaDB has failed on me in the recent past while testing it.

0

I've not used that, though it looks to be active development at the moment. The newest version should be able to handle it in some capacity such as rejecting a row if a text field is non-valid JSON, creating a virtual column which takes a value equal to a named attribute pulled from a JSON field (not sure what happens if that attribute is missing), and indexing on that pulled value.

This will probably be the next case of me finding a good use for that feature soon after finding out about it.

0

The use case for me is an e-commerce situation where we want to create a copy of the user's cart upon checkout, but we don't want to leave entries in a cart table that is constantly growing. We'd rather deal with it on the same table we track orders with so when we archive them we have all the relevant information in a single record, not related records. Having a JSON column to store the cart data is a whole lot easier than who knows how many pivot table entries.