1

This is my table with a small sample data:

    orbId  orbPosition  layoutName
    1      6.7         FirstLayout
    2      7.3         FirstLayout
    3      8.4         FirstLayout
    1      5.5         SecondLayout
    2      6.8         SecondLayout

I am using SELECT query to fetch everything with WHERE clause on layoutName. Is it better if I save multiple orbs in one rows and have less rows instead for example:

  orbId          orbPosition         layoutName
 ["1","2","3"]  ["6.7","7.3","8.4"]  FirstLayout
 ["1","2"]      ["5.5","6.8"]        SecondLayout

Let me know pros and cons of both methods and which method is better suitable.

Sameer Hussain
  • 2,421
  • 8
  • 23
  • 41

1 Answers1

0

If you want to update/modify this data you should go with first approach else if the data is permanent and needs no change and not needed to be queried individually, then second way is better.

Considering that you have fixed setting for a layout and you need not to modify at any time* and you need not to fetch it individually then you should go with second approach.

Update

For better performance first approach is better as the rows grow, index thing will take care of it.

Vishal Kumar Sahu
  • 1,232
  • 3
  • 15
  • 27