What are some best practices for structuring database tables and relationships to optimize PHP application performance?

Issue: To optimize PHP application performance, it is important to structure database tables efficiently and establish relationships between them effectively. This can help reduce redundant data, improve data retrieval speed, and enhance overall application performance. Code snippet:

CREATE TABLE users (
    id INT PRIMARY KEY,
    username VARCHAR(50) NOT NULL,
    email VARCHAR(100) NOT NULL
);

CREATE TABLE posts (
    id INT PRIMARY KEY,
    title VARCHAR(100) NOT NULL,
    content TEXT NOT NULL,
    user_id INT,
    FOREIGN KEY (user_id) REFERENCES users(id)
);