I am building a system that in production will have something like the below profile:
- mySQL development database (production database may be different)
- 20-30 tables (depends on extent of normalisation)
- 'main' 4 tables having 300+ million records (each of which includes a text field that is populated for around 10% of records and can have comments up to around 4000 characters)
- Around 100 simultaneous users
In order to try and optimise things, I am thinking it would be an advantage to separate out these long text fields where they exist and put them in their own table(s).
- Is the above correct practice?
- Is the below code to split the
Item
entity into two the correct way to handle it?
Item entity:
/**
* @ORM\Entity
* @ORM\Table(name="Items")
*/
class Item
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $name;
/**
* @ORM\Column(type="timestamp")
*/
private $datetime;
/**
* @OneToOne(targetEntity="Item_comment")
* @JoinColumn(name="comment_id", referencedColumnName="id")
*/
private $comment;
}
Item Comments entity:
/**
* @ORM\Entity
* @ORM\Table(name="Item_comments")
*/
class Item_comment
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="text")
*/
private $comment;
}