I'm currently designing my mysql db for an app i'm developing.
I like it when Stored Procedures
are short and readable, and since my db involved some join
statements, I thought maybe I should create Views
with all the joins
and query these Views
from my Stored Procedures
.
At first it sounds great, but when I though about performance, I realised that whenever a Stored Procedure
is called it will run at least 2 queries:
- The
View
query - The
Stored Procedure
query on thatView
while using the join
statements inside the Stored Procedure
I will have only on query doing the joining and the selection from the join.
Am I right?
If so - what will be a good practice to maintain great development performance in terms of elegant code writing ?