Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using mysql database.
I am fetching 5000 records and binding those records to a tree control.
In that, I use for loop where I am populating root node bind to tree and then fetching that root nodes child node from the database and binding to the tree control.

I am using stored procedure instead of queries and indexing to my database table.

I want to increase my page performance because it takes too much time (30 sec for 5000 records) to load the records.

As records will be added later so it will affect my page performance.

What Should I do?

Thanks
sjs
Posted
Updated 1-Dec-10 21:56pm
v3
Comments
Sunasara Imdadhusen 1-Dec-10 8:20am    
How you would fetching records to bind tree?
Tarun.K.S 1-Dec-10 8:32am    
Edited for readability.
sjs4u 1-Dec-10 8:34am    
I am using store procedure in that I am getting records of root node and I am binding to tree and after that on that root nodes id I am fetching child node from the db and binding to tree view
Tarun.K.S 1-Dec-10 8:36am    
Using a tree control is not a good idea. If you really must use a tre, then implement Lazy Loading.
R. Giskard Reventlov 1-Dec-10 8:40am    
Load only the parent nodes then load each node as it is opened. Also, take a look at obout.com - I seem to recall that they implement a pretty efficient data driven tree control.

I have done such things in the past, some insights:

* call SuspendLayout on the TreeView before adding nodes and ResumeLayout after
2. think about how you fetch the data - if you connect to the database again and again it could be a problem. Maybe you can build an internal tree representation out of the complete data before building the nodes.
3. think about loading the data async(!) or "lazy" as others told you.
4. cache the relevant data in the node tags for later use.
5. from an UI perspective such a big treenode is not nice, maybe you can categorize it or split it into smaller portions. If there are few root nodes (for splitting) and very deep nesting, lazy loading is the way to go. Always build just the next level of nodes, so the user can expand the node (the little plus sign is shown if you add child nodes)
6. If this tips does not help, show some code maybe you have some other performance problems?
 
Share this answer
 
v2
Comments
Dalek Dave 2-Dec-10 3:56am    
Good Answer.
Tarun.K.S 2-Dec-10 3:57am    
Nice tips!
Drug Guide Computer http://www.mahwey.com/ - order diazepam Pharmacological interactions must be given attention when prescribing Valium with other medications. [url=http://www.mahwey.com/]cheap valium online[/url]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900