|
-
Jan 31st, 2006, 01:56 PM
#1
Thread Starter
Addicted Member
SQL Speed
I have VB6 program that uses SQL queries and an ADO connection to connect to a MS Access 2002 database. The database contains on an average 40,000+ records. The first screen in the program loads the contents of the database to a listbox; obviously this takes a while. The users want to maintain the ability to see everything, but want it to load faster. Is there a way to load faster via using a stored procedure in Access or something of that nature? Any suggestions are welcomed. Thanks.
Last edited by manofsteel00; Jan 31st, 2006 at 02:01 PM.
Reason: wording
Nenio foriras ĝis ĝi havas instru ni kiu ni devas scii.
-
Jan 31st, 2006, 02:09 PM
#2
Re: SQL Speed
Access .mdb files do not support Stored Procedures. There are a few things you can do to make it appear as loading faster but not much else. Are you using ADO Command Objects and Forward-Only and Read-Only recordset? They are faster.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 31st, 2006, 02:11 PM
#3
Re: SQL Speed
Although Rob has made about the only recommendation to speed things up that I can think of, even making his changes really isn't going to get you much.
Why in the world do your customers want to see 40,000 items in a listbox? That is insane. Not only will it take time to load, but it will also take time to find stuff. Is this database going to grow? A listbox has a limit of 32K
-
Jan 31st, 2006, 02:16 PM
#4
Re: SQL Speed
The other thing is (on top of what's been mentioned), make sure you index the tables by the fields you use in your where clause. It'll slow your INSERT and UPDATE slightly, but your SELECTs and DELETEs get a huge boost.
-
Jan 31st, 2006, 02:16 PM
#5
Re: SQL Speed
Why not give them some options for filtering the data and seeing it all too. So at the startup you would load only the most recent data maybe and then if they want to look at it all they would use the filter to remove the filtering condition. After a while they may realize how slow it is to see everything and not use it or want it much.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 31st, 2006, 02:30 PM
#6
Thread Starter
Addicted Member
Re: SQL Speed
The program is for a cycle count (an audit for food). The user wants to be able to chose from multiple Pick slots, which is how they want to see the data. It just takes around two entire minutes to load the selection screen.
Nenio foriras ĝis ĝi havas instru ni kiu ni devas scii.
-
Jan 31st, 2006, 02:35 PM
#7
Re: SQL Speed
 Originally Posted by manofsteel00
It just takes around two entire minutes to load the selection screen.
I can certainly understand that, but with that many records, I don't see how you are going to get around it.
What about growth? As I mentioned, if it gets too big you could wind up with a problem. You are only going to get 32K worth of data in a standard VB listbox.
If you foresee the number of items growing, I would encourage you to begin, now, to look around for a third party replacement for that listbox.
-
Jan 31st, 2006, 02:41 PM
#8
Re: SQL Speed
One of the things you may be able to do is mimic a full search without grabbing all of the records. I don't know if this is possible in VB6, but only query the TOP 1000 initially and then if they scroll to the bottom, add the next 1000 (TOP 1000 WHERE field > 'LastValueInListBox') to the listbox and continue with that. You're still heavy on the DB end, but atleast your startup cost will be lighter.
-
Jan 31st, 2006, 03:15 PM
#9
Thread Starter
Addicted Member
Re: SQL Speed
How could I implement the ADO Command Objects and Forward-Only and Read-Only recordsets?
-
Jan 31st, 2006, 03:25 PM
#10
Re: SQL Speed
We stop loading all listbox and combo boxes at 200 row - more then that is painful for the user.
Why are you against the suggestions you've gotten to query the user for data that will help to lessen the number of rows retrieved from the database?
-
Jan 31st, 2006, 10:50 PM
#11
Re: SQL Speed
You may try the Listview control instead...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|