A stored procedure is a set of SQL
commands that can be compiled and stored in the server. Once this has been
done, clients don't need to keep reissuing the entire query but can refer to
the stored procedure. This provides better performance because the query has to
be parsed only once, and less information needs to be sent between the server
and the client. You can also raise the conceptual level by having libraries of
functions in the server.
A trigger is a stored procedure that
is invoked when a particular event occurs. For example, you can install a
stored procedure that is triggered each time a record is deleted from a
transaction table and that automatically deletes the corresponding customer
from a customer table when all his transactions are deleted.
The planned update language will be
able to handle stored procedures, but without triggers. Triggers usually slow
down everything, even queries for which they are not needed.
No comments:
Post a Comment