Rangga's Journals

A first step to a professional world
See also: Other Geeks@INDC

May 2008 - Posts

Penggunaan Index pada SQL Server 2005

 

Penggunaan index pada database merupakan salah satu teknik pembuatan database yang baik. Hal ini terutama sangat berguna pada implementasi database dengan skala VLDB (Very Large Database) atau OLDB (Online Large Database). Saat database dibuat tanpa menggunakan index, maka kinerja server database dapat menurun secara drastis. Hal ini dikarenakan resource komputer banyak digunakan untuk pencarian data atau pengaksesan query SQL dengan metode table-scan. Index pada kolom-kolom tabel database mempunyai fungsi seperti indeks kamus atau indeks buku. Hal ini membuat pencarian data akan lebih cepat dan tidak banyak menghabiskan resource komputer. Oleh karena itu, memiliki pemahaman akan konsep indexing, teknik implementasi, dan memahami kapan saat tepat untuk menerapkan metode ini merupakan hal yang berguna terutama bagi para enterprise application developer atau database administrator.

Anda dapat mendownload file pdf-lengkap melalui link dibawah ini :

Download artikel penggunaan index pada SQL Server 2005 

Tulisan ini juga dipublikasikan di situs ilmukomputer.com.

Semoga bermanfaat. Salam!

Rangga Praduwiratna

Performance Monitor in SQL Server 2005

There's a lot of ways to increase performance of our databases in SQL Server 2005. And there's so many tutorials about these. Like implement index, use of stored procedure, etc. But actually, how we can monitor our database performance in SQL Server, so we could review our works.

In this tutorial, I'll try to give a simple tutorial about monitor SQL Performances.

Performance Monitor 

Yap, it's that easy! Use performance monitor if you want to know about your database performance. Easy and simple. We maybe know about these features in Windows, but, how do we use it?

1. Open Performance Monitor in your Windows

*For WinXP you can open it by browse Control Panel > Administrative Tools > Performance

*For Windows Server 2003, you just click performance monitor in Administrative Tools in Start Programs

2. You can add more performance object monitor by simply click add button in menu bar (simbolize by plus button), so you can monitor your database performance.

Okay, we could use this feature now. But performance monitor is not a powerfull feature unless you understand about it's parameter to achieve good performance, right? Here some tips : 

- Add memory object (Available bytes), check it's value!  if your graph show more than 4Mb, well we can claim it as a good performance. This number should be low because Windows uses as much RAM as it can grab for file cache

- Add Processor object (%Processor Time), check it's value! The recommended value is less than 75%, if your graph show number higher than these, maybe you should add more processor, or do some tuning like partitioning and filegroup-ing and move some filegroups to other server.

- Add memory object (Pages/Sec), check it's value! The recommended value is fewer than 5. If this is too high, it means your system is compensating for a lack of RAM by paging to disk.

Well actually, there's another performance object you can use, but I won't explain all of those in here, because it'll be too time-consuming. These 3 object is commonly used by DBAs to monitor their server performance and their database performance. If your abilities in tuning your database is good, you can reduce your server workload, and also save your computer resources. :)

Display Estimated Time Plan

Yap, you also can check whether your database need indexing or not, by using Display Estimated Time Plan. Here the illustration :

Commonly, people use a normal table scan method for their tables. This method is used when we don't implement index or primary key in our tables. This method can cause more time when querying your database if your database is a VLDB (Very Large Database) and you have million rows in your table. So you need to implement index in your tables. 

You can check estimated time plan comparison between table-scan method and index-method by using Display Estimated Time Plan feature. For example, try to check estimated time plan for your table with table-scan method. Check your database performance by use select query or more complex query to retrieve data in your tables. After the results is shown, select 'Query' in your menu bar, and click Display Estimated Time Plan. Move your mouse cursor to method's shown in there (it could be either table scan or index method), and it will pop up message contains Estimated CPU cost time. After that, try to implement index for your table/database. You can use Database Engine Tune Advisor or manually create index for your tables/database. You can compare the results before you implement index (use table-scan method) and after you implement index.

FYI : table-scan method isn't always be a bad method. It could be give a better performance if your database is small or just contains hundred to thousands rows in your tables.

Hope this post is usefull. 

 

Regards,

Rangga Praduwiratna 

*References : Sybex and Microsoft Press books for Implementing and Maintaining SQL Server 2005. 

 

Penggunaan Stored Procedure dalam SQL Server 2005

Apa yang dimaksud dengan Stored Procedure? 

Stored Procedure merupakan struktur pemrograman yang cukup umum digunakan di dalam database administration dan development. Jujur saja, saya juga baru mulai mempelajari kegunaan dan pemakain fitur ini dalam pemrograman aplikasi. Sebuah stored procedure merupakan sebuah nama yang dapat diasosiasikan dengan batch dari kode pemrograman SQL yang disimpan di server database. Kita juga bisa menganalogikan stored procedure sebagai sebuah fungsi yang bisa dipanggil sewaktu-waktu, tapi jangan termind-set dengan istilah ini ya, karena di SQL Server 2005 juga ada fitur function

Apa kegunaan Stored Procedure?

Begini ilustrasinya. Jika kita menggunakan query untuk mengambil data dari database (terutama untuk VLDB - Very Large Database) dan menggunakan beberapa query untuk menggabungkan beberapa tabel data tentu akan membebankan resource komputer server. Apalagi untuk kasus VLDB dimana besar kemungkinan bagi beberapa user mengakses data dengan query tersebut secara bersamaan.

Penggunaan Stored Procedure membuat hal ini menjadi lebih simpel dan mudah serta meningkatkan performance server. Stored procedure tersebut kemudian dapat kita panggil dari aplikasi user.

Nanti saya contohkan penggunaan stored procedure di SQL Server dan di pemrograman aplikasi menggunakan Visual Studio 2005.
Instalasi SQL Server 2005 Enterprise Edition 32-bit di Windows

Mumpung masih seger di ingatan, jadi saya mau sedikit membahas cara instalasi SQL Server 2005 Enterprise Edition 32-bit edition, karena proses instalasi yang baik (clean installation) merupakan sebuah kemampuan yang mendukung pekerjaan kita. Ok, pertama-tama kita harus tahu terlebih dulu OS yang compatible untuk aplikasi ini.

Berikut adalah daftar OS yang compatible untuk melanjutkan proses instalasi :

- Windows Server 2003 Standard/Enterprise/Datacenter Edition SP1

- Windows  Small Business Server 2003 Standard/Premium Edition SP1

- Windows 2000 Server SP4

- Windows 2000 Advanced Server SP4

- Windows 2000 Datacenter Server SP4

- Windows XP Professional Edition SP2

Kemudian, minimum hardware requirement yang dibutuhkan untuk proses instalasi :

-  Processor 600 Mhz, 1Ghz keatas lebih direkomendasi.

- Memory 512 Mb (minimum)

- Hard disk space : 350 Mb dan tambahan 425 Mb untuk instalasi SQL Server Books Online, Sample Databases, dan Sample Code

Nah, setelah mengidentifikasi kebutuhan OS dan hardware, maka proses instalasi dapat dilanjutkan.

1. Pertama-tama masukkan cd SQL Server 2005 Enterprise Edition, dan pilih proses instalasi

2. Pada halaman Installing Prerequisites Page, tekan tombol next.

3. Pada halaman Welcome to the Next Installation Wizard juga tekan tombol next.

4. Setelah ini, SQL Server akan mencek system configuration pada komputer Anda, dan menunjukkan komponen apa saja yang sudah ada dan belum ada untuk meneruskan proses instalasi. Jika ada komponen yang menunjukkan status warning, coba dicek terlebih dulu apa penyebabnya dan apa nama komponennya, mungkin Anda belum mengaktifkan component Windows tersebut.

5.  Jika sudah selesai, maka Anda dapat meneruskan proses instalasi dengan menekan tombol next.

6. Isikan nama Anda dan nama perusahaan Anda di halaman berikutnya, jika sudah tekan tombol next.

7. Pilih komponen yang ingin Anda install di halaman ini. Integration Service merupakan fitur baru di SQL Server 2005 yang menawarkan banyak keuntungan dan kemudahan administrasi database. Jika Anda ingin bereksplorasi, aktifkan semua komponen. Kemudian pilih menu Advanced untuk menginstall sample databases, SQL Server Books Online, dan Sample Codes. Setelah konfigurasi selesai dilakukan, tekan tombol next.

8. Di halaman berikutnya pilih default instances untuk Instances Name Anda. Untuk catatan, Anda dapat menginstall lebih dari 1 instances, tapi untuk instalasi pertama kali, Anda harus menginstall default instances ini. Instances dapat diumpamakan sebagai server baru. Anda dapat mengaktifkan instances baru untuk masalah kompatibilitas dengan SQL Server edisi sebelumnya, testing software, dll. Tekan tombol next setelah selesai.

9.  Pada halaman Service Accounts, pilih Local System, kemudian pilih tombol next. 

10. Pada halaman ini, Anda harus memilih mode autentikasi yang ingin Anda gunakan. Bagi Anda yang baru pertama kali mencoba aplikasi ini, sebaiknya Anda pilih Windows Authentication Mode terlebih saja. setelah selesai, tekan tombol next.

11. Pada halaman Collation Settings, Anda dapat memilih mode collation yang ingin Anda gunakan. Untuk default, SQL Server akan menggunakan incase-sensitive,inaccent sensitive, dan sebagainya. Tekan tombol next jika sudah selesai.

12. Pada bagian error report pilih bagaimana sikap Anda jika ada error pada SQL Server 2005, tekan tombol next jika sudah selesai.

13. Jika sudah mencapai tahap ini, berarti Anda sudah siap menginstall SQL Server 2005. Anda akan diberikan review konfigurasi yang telah Anda pilih sebelumnya di halaman ini. Tekan tombol install jika sudah selesai.

14. Setelah selesai. Klik tombol finish.

Yap itu tadi step-by-step proses instalasi SQL Server 2005. Untuk berikutnya, Anda dapat menyesuaikan proses instalasi sesuai kebutuhan Anda. Selamat mencoba.

 *Maaf, bahasa jadi campur aduk, Indonesia-Inggris. He2.. Masih gagap kalo pake Inggris buat nulis artikel begini. Nanti tutorialnya bakal dilengkapi dengan screenshot.

Rangga Praduwiratna 

MCTS (Microsoft Certified Technology Specialist)

MCTS stands for Microsoft Certified Technology Specialist. It's a new generation certification which is released by microsoft (for more information, you can enter microsoft site). It has several advantages than the old credentials.

"The Technology Specialist certifications enable professionals to target specific technologies and distinguish themselves by demonstrating in-depth knowledge and expertise in their specialized technologies."

Yap, when you become an MCTS, you could show your expertises in certain technologies. It will help companies who are looking for new employees to find out your expertises.

Hello World!

8 May 2008

*Important Activity : Join as a new member of INDC

Hello World! It's a common message, when we try program. Don't know, when this 'magic word' become popular, but I'm still using it right now, when trying new programs or technologies. So, in this opportunity, I also use this 'magic word' to test out blog features in here and also say hello to all of you. I'm still a new member in here, but I hope I could give a lot of contributions to this community and to Indonesia.

 

Rangga Praduwiratna