tips optimisasi sql server

Dari MS SQL City, ada beberapa tips menarik (sebagian belum diterjemahkan) mengenai optimisasi sql server.

  1. Gunakan SP sebagai alternatif kueri yang berat.
  2. Gunakan SET NOCOUNT ON untuk menghindari munculnya pesan jumlah data yang terpengaruh.
  3. Gunakan nama terkualifikasi lengkapnya: server.db.owner.object untuk memberikan kesempatan server menggunakan ulang rencana eksekusinya.
  4. Gunakan nilai keluaran integer untuk apapun untuk menghindari pembuatan recordset.
  5. Don’t use the prefix “sp_” in the stored procedure name if you need to create a stored procedure to run in a database other than the master database.
  6. Use the sp_executesql stored procedure instead of the EXECUTE statement.
  7. Use sp_executesql stored procedure instead of temporary stored procedures.
  8. If you have a very large stored procedure, try to break down this stored procedure into several sub-procedures, and call them from a controlling stored procedure.
  9. Try to avoid using temporary tables inside your stored procedure.
  10. Try to avoid using DDL (Data Definition Language) statements inside your stored procedure.
  11. Add the WITH RECOMPILE option to the CREATE PROCEDURE statement if you know that your query will vary each time it is run from the stored procedure.
  12. Use SQL Server Profiler to determine which stored procedures has been recompiled too often.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s