Back to archive

Note Table Design in MySQL for SmartNote

A focused design note on the note table structure, indexing strategy, and soft-delete decisions.

MySQLJavaBackend

The note table is the center of SmartNote, so I designed it for both current features and next-step expansion.

Core fields#

  • id: primary key
  • user_id: owner reference
  • title: note title
  • content: body content
  • is_deleted: soft-delete flag
  • create_time, update_time: timestamps

Why soft delete#

Soft delete protects data recovery and auditability. It is useful when users delete by mistake or when features like restore/trash are added later.

Indexing direction#

At minimum:

  • index on user_id
  • index on (user_id, update_time) for personal lists

When search expands, move keyword handling to dedicated search strategy instead of overloading basic indexes.

API implications#

With this table, the service layer can support:

  • create note
  • update note
  • list notes by user
  • soft delete note
  • later: favorites and recommendation signals

Closing#

Good schema design is not about complexity. It is about predictable evolution. A clear note table keeps the rest of the backend easier to implement and explain.

Related posts

View all