+ Reply to Thread
Results 1 to 3 of 3

ADODB Connections are veeeery slow

  1. #1
    Registered User
    Join Date
    10-21-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    21

    ADODB Connections are veeeery slow

    I wonder if it anyone know any good tips & tricks to improve performance on ADODB Connections.
    Sometimes it goes veeery slow to open the connection and running the query takes under a second and other times opening the connection goes fast but running the query takes ages.

    I have noticed that its usually the first time the query is runned its taking the longest. If the same query is beeing run again it goes ALOT faster.
    I have tried running a simpler query to the DB when opening the worksheet to improve the time it takes to open the connection, but it doesnt seem to help that much for some reason.

    The SQL statements are also pretty huge, around 2000 characters (no spaces)
    I read somewhere else that adding:
    rec1.CursorLocation = adUseClient
    rec1.CursorType = adOpenStatic
    might help. But didn't see much difference.

    Please Login or Register  to view this content.
    As you can see from the code its 2 different servers that the querys can go to. So one question is that if I run a query on Server 1 does the connection to server 2 get terminated?
    Is there a way to keep both connections open?

    Here are the methods I run when the sheet is opened. Theese query goes very fast to open connection and run. So question again is if this actually should help? Are the connections beeing kept alive?

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by stibay; 01-08-2014 at 05:10 PM.

  2. #2
    Forum Contributor gsnidow's Avatar
    Join Date
    07-22-2010
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2007
    Posts
    150

    Re: ADODB Connections are veeeery slow

    Quote Originally Posted by stibay View Post
    Here are the methods I run when the sheet is opened. Theese query goes very fast to open connection and run. So question again is if this actually should help? Are the connections beeing kept alive?
    stibay, I'm assuming you are connecting to SQL Server (based on the "SELECT TOP 1...")? If I am not mistaken, SQL Server will cache the execution plan of a query by a user. So, that is why a slow running query often seems to run faster the next time you run it. However, once the connection is terminated, the cached execution plan is gone. But you would need to ask your SQL Server guy to trace what is happening. Now, your "SELECT TOP 1..." querries are going to be fast since you are only selecting the top 1 or 10 or 100 or whatever, based on the indexes on the tables. Once you take out the "TOP 1...", the rest is back to square 1, in that the query optimizer will have to create a new execution plan for you. I would think even if your Excel file kept the connection alive, SQL Server is going to kill it after an amount of idle time. I think you will be able to answer a lot of your questions by working with the DB admin.

    Greg
    Just a guy trying to make work stuff easier.

  3. #3
    Registered User
    Join Date
    10-21-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: ADODB Connections are veeeery slow

    It's a Sybase server.
    More spesificly Sybase ASE 11/12/15 - com.sybase.jdbc4.jdbc.SybDriver

    The querys run very fast in a sybase query program.
    It's more opening the connection and running it in Excel which takes alot longer for some reason.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro is running real slow and makes navigating the worksheet really slow after execution.
    By MichWolverines in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2013, 04:29 PM
  2. [SOLVED] slow computer (slow clipboard) breaks my macro
    By twilsonco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 09:16 PM
  3. Replies: 2
    Last Post: 05-24-2012, 08:43 AM
  4. push:ADODB Connections
    By Slyone2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2010, 01:11 PM
  5. [SOLVED] ADODB Connections
    By MChrist in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-07-2005, 04:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1