As i see it, the Reply in second method is considered Weak entity...
Correct.
...because reply is strongly tied to ticket.
Not sure what you mean by that. It is weak because it cannot be identified without attributes migrated from the parent.
However, i prefer the first method because its easier to deal with at the programming level; in first method, we only have to handle one PK. Do you agree? Why and Why Not?.
Well, it depends ;)
The strong entity and non-identifying relationship (your "first method"):
- May be friendlier to client code, especially if you use ORM.
- Prevents the parent PK from propagating further down the table hierarchy1, which:
- Will make child FKs leaner.
- Will "cut" the ON UPDATE CASCADE and prevent it from propagating further down the table hierarchy.
The weak entity and identifying relationship (you "second method"):
- Results in a PK that is a good candidate for a clustering key.2
- Avoids additional index on FK3, since primary index covers both fields4. Every additional index costs space and performance (when modifying data).
- Propagates the parent PK down the table hierarchy1, which:
All in all, neither solution is absolutely "better" - it's a matter of choosing the right balance.
1 Not (yet) relevant in your case, since you don't (yet) have any tables that reference Reply
.
2 Many (but not all) DBMSes allow clustering only on the PK. In your case, clustering on {ticket_id, reply_id}
(note the order of fields) would store all replies connected to the same ticked physically close together, dramatically reducing I/O for certain kinds of queries.
3 Which would otherwise be necessary for efficiently enforcing the referential integrity when deleting or modifying rows from Ticket
.
4 Assuming you change the order to {ticket_id, reply_id}
.