Question

  Asked: Oct 2 2007   8:40 AM GMT
  Asked by: Micus2005


database sql,with vb coding,first time running not fast


Visual Basic 6, SQL database

we have an accounting package written in visual basic 6.0 and sql database,the problem is when we open the database the first time,it takes lot of time,but when we open it after, it will be very fast and remain fast ,even when we quit the application and restart it.

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



This will be because the first time you connect the database has to be opened and the information that you are looking for loaded from disk into memory. This is called caching the data. SQL caches as much data as possible into it's buffer. The more often the data is needed the longer it will stay in the buffer. Let used data is eventually flushed from the buffer as more recently used data is cached.

Also make sure that your database does not have the auto-close option enabled. With this option enabled when all users leave for the data, SQL will close the file and flush the cache which removes all the cached data from memory writting it back to disk.

You may need to look at your indexs on the tables which you are using, as incorrectly indexed tables can force SQL Server to load more data than is actually needed into memory which then takes longer than expected.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development and SQL Server.

Looking for relevant Development Whitepapers? Visit the SearchWinDevelopment.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

BrentSheets  |   Oct 2 2007  3:40PM GMT

Micus2005, I’m not a SQL guru but I did come across the thread below on Microsoft Forums. Although the post was about storing images in SQL, the dialog is about how to mitigate slow loads.

<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1540589&SiteID=1" rel="nofollow">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1540589&SiteID=1</a>

Hopefully, a real SQL guru will come along and hit the “Create Answer” button. Good luck.

 

Mrdenny  |   Feb 22 2008  4:58AM GMT

Was this information useful in resolving your issue?

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.