Performance Improvement for ODP.Net OracleDataAdapter
4/15/2013 08:24:00 PM
Gönderen Mete Karar
Recently I faced with a performance complaint for a query. Query was simple as it could be, just a "select * from some_table". When I digged out the problem with my fellow developer, we discovered that almost all time was spent while the data adapter fills the data table. Table had a little more than 155K rows and was size of 31 MB. Yet, it took more than 5 minutes to complete for data adapter to fill data table.
The cause of the problem was the number of round trips client need to accomplish to get all the rows from database. If you can reduce the number of round trips, you can increase the fetch size so that in each turn command object will fetch more rows from database. Here is how it's impletemented:
using (OracleConnection conn = new OracleConnection())
{
OracleCommand comm = new OracleCommand();
comm.Connection = conn;
comm.FetchSize = comm.FetchSize * 8;
comm.CommandText = "select * from some_table";
try
{
conn.Open();
OracleDataAdapter adap = new OracleDataAdapter(comm);
System.Data.DataTable dt = new System.Data.DataTable();
adap.Fill(dt);
}
finally
{
conn.Close();
}
}
Notice the line with blue font, fetch size of command object increased by 8 times its default which is 128 KB at ODP.Net 11.2.0.3. OracleDataReader also has the FetchSize property. By increasing fetch size, you increase the cache size in memory to fetch rows.
What we gained is up to 96% performance improvement. Here are some timings with different fetch sizes:
Fetch Size | Timing (MI:SS.FF3) |
Default (128 KB) |
05:20.290
|
Default x 8 (1 MB) |
00:52.941
|
Default x 32 (4 MB) |
00:26.008
|
Default x 64 (8 MB) |
00:12.409
|
It's a easy way to improve your application's performance, isn't it.
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
Oracle
. Follow any responses to this post through RSS. You can leave a response, or trackback from your own site.
Subscribe to:
Post Comments (Atom)
17/6/16 18:46
What's about ?
OracleDataReader.FetchSize = OracleDataReader.RowSize * 100;
11/11/18 22:28
Ayam ayam jago Terbaik di Indonesia
situs sabung ayam
5/12/18 10:06
Uygulamada çoklu dil desteğini sağlayan resource key-value değerlerini, bulutta koşan veri tabanından çekerken yaşadığımız yavaşlık problemini bu ayar sayesinde atlattık. Teşekkür ederiz.
8/12/18 22:26
Ayam ayam jago Terbaik di Indonesia
sabung ayam bali
18/1/19 06:45
Ayam ayam jago Terbaik di Indonesia
adu ayam pisau
25/1/19 18:47
Ayam ayam jago Terbaik di Indonesia
ayam tarung bangkok
15/2/19 06:44
Ayam ayam jago Terbaik di Indonesia sabung ayam pw
10/6/20 21:03
Yuk di add pin WA: +628122222995
Sabung ayam online dan semua jenis permainan judi online ..
Semua bonus menarik kami berikan setiap hari nya ... :)
www,bolavita, ltd sabung ayam peru
18/8/20 19:18
Manfaat Bawang Bombay Jika Diberikan Pada Ayam Bangkok
23/11/21 22:30
Daftar & Mainkan Sekarang Juga Slot Gacor Hanya di Pelangi4D
Raih Kemenangan Hoki Terbesar Kamu !!!
Bonus New Member 10%
Bonus Harian 5%
dan Bonus Lain-lainnya !!!
Link: angkaindo,info
WA: : +6281287736082
Terimakasih Salam Jackpot !!!
19/4/22 11:37
Mete Karar'S Weblog: Performance Improvement For Odp.Net Oracledataadapter >>>>> Download Now
>>>>> Download Full
Mete Karar'S Weblog: Performance Improvement For Odp.Net Oracledataadapter >>>>> Download LINK
>>>>> Download Now
Mete Karar'S Weblog: Performance Improvement For Odp.Net Oracledataadapter >>>>> Download Full
>>>>> Download LINK TR