am used great deal of time , i understand the diff between sql query and sp ,
SQL query will be compiled everytime it is executed. Stored procedures are compiled only once when they are executed for the first time.
This really is general database question
Only one large doubt is ,
For instance ,
one dynamic work , that's i pass the userid to SP and sp will return the username,password,full particulars,
So with this scenario the query should execute once more know, what exactly may be the necessary of SP rather than SQL QUERY ,
Please obvious this doubt ,
Hi thanks for your updates,
however i dont want the benefit, comparison ,
just say ,
How sp performing , in the end opt for dynamic works,
For instance ,
if pass userid 10 then sp also read records 10 ,
basically pass 14 then, SP again look the 14 records , check this out same work NORMAL SQL QUERY
doing , but on that point execute and fetching ,why must i choose sp ,
Saved methods, such as the title states, are saved around the database server. They're sent towards the server and put together whenever you create them, and performed whenever you give them a call.
Simple SQL queries, however, are sent towards the server and put together every time you rely on them.
So transmitting of the huge query (rather than an easy "execute procedure" command) and producing create an overhead which may be prevented through a saved procedure.
MySQL, like other RDBMS, includes a query cache. But this avoid only producing, and only when the query is the same than the usual formerly performed query, meaning the cache sits dormant should you execute 2 occasions exactly the same query, with various values inside a where clause, for instance.
I see pointless for any saved procedure only to query for those user particulars.
Saved methods are functional code that you simply execute around the database server. I'm able to think about three good reasons why you'd rely on them:
- To produce an interface for customers that hides the schema particulars from clients.
- Performance. Extensive information on the large data set may be done more effectively around the database server
- Sometimes it can be hard (or impossible, based on your skill) to convey what you believe you'll need inside a declarative, set-based language like SQL. This is when many people provide their hands and write saved procs.
Only One. could be justifiable out of your question. I would suggest adhering with SQL.
UPDATE: The brand new information you provided still doesn't justify saved methods for me. A question that returns 14 records is routine.