2

I'm using mysql 5.7
I'm making app that has 2 activities: list of entities and viewing single entity (full).

The full entity has 7 related entities and 100 columns.

On the list activity I need only 5 columns and 2 related entities.

I'm thinking if I make separate table for the listing (5 columns + 2 related entities) denormalized. And then when searching through normalized columns get only ids. And get all deneromalized stuf with single where id in 1,5,7 manner.

Would it singificantly increase performance or should i don't bother?

I'm making an android app and want the best speed i can get but dunno if it really matters

1
  • Short Answer: "It depends". Long Answer: "It depends. If you want more specifics, write out the CREATE TABLEs and SELECTs."
    – Rick James
    Mar 25, 2018 at 0:44

2 Answers 2

1

Generally it is best to hold data in a normalised structure.

If testing at scale, on production-grade hardware, proves there is a problem, and that the problem is because of an over-large table, and index tuning and SQL re-factoring do not bring the problem withing acceptable bounds, then splitting the table is a recognised technique.

Moving some rows to a different table is called horizontal partitioning or sharding. Moving some columns to a different table is call vertical partitioning. Both entail additional design and maintenance work. There will be run-time implications if values from several partitions are required by a single query.

There is some further discussion at this answer.

0

It is a better option to normalize database with smaller multiple tables having Primary Keys and Reference Keys. It will increase performance by tables having Primary Key in a table and another table uses it as Reference Key.

2
  • 2
    If you're quoting a source it's a good idea to include a reference, or even a link. Mar 21, 2018 at 10:57
  • Yeah, I would like to see what you are quoting. I usually disagree with the claim stated there.
    – Rick James
    Mar 25, 2018 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.