Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Database performance 5 times faster with Access than with MS SQL
Forum Updated to NodeBB v4.3 + New Features

Database performance 5 times faster with Access than with MS SQL

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 879 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andy314
    wrote on 20 Apr 2023, 11:13 last edited by
    #1
    1. Fast Secenario

    I have the following connections.
    Qt (Driver 1)-> MS Access (Driver 2) -> MS SQL
    All Tables and Querys are linked in the Access DB.

    Driver 1:
    DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:__CarDamageDeveloppement\Exe\UserData\ldata.accdb

    Driver 2:
    DRIVER=SQL Server;Server=localhost\SQLEXPRESS;Database=CarDamage;Uid=yyyy;Pwd=xxx;WSID=.

    With this two-chained connectioin I can load with one query 1 Million records in 35 Seconds.

    1. Slow Secenario

    This is a direct connection to the MS SQL Server
    Qt (Driver 2) -> MS SQL

    Same query costs about 200 seconds.

    This is very strange, because Scenario 1 makes more an should be slower. Why is the direct connection to MS SQL that uses the SAME connition configuration as from Access to MSSql so slow ?

    J 1 Reply Last reply 20 Apr 2023, 12:00
    0
    • A Andy314
      20 Apr 2023, 11:13
      1. Fast Secenario

      I have the following connections.
      Qt (Driver 1)-> MS Access (Driver 2) -> MS SQL
      All Tables and Querys are linked in the Access DB.

      Driver 1:
      DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:__CarDamageDeveloppement\Exe\UserData\ldata.accdb

      Driver 2:
      DRIVER=SQL Server;Server=localhost\SQLEXPRESS;Database=CarDamage;Uid=yyyy;Pwd=xxx;WSID=.

      With this two-chained connectioin I can load with one query 1 Million records in 35 Seconds.

      1. Slow Secenario

      This is a direct connection to the MS SQL Server
      Qt (Driver 2) -> MS SQL

      Same query costs about 200 seconds.

      This is very strange, because Scenario 1 makes more an should be slower. Why is the direct connection to MS SQL that uses the SAME connition configuration as from Access to MSSql so slow ?

      J Offline
      J Offline
      JonB
      wrote on 20 Apr 2023, 12:00 last edited by
      #2

      @Andy314
      A vital factor for SQL queries is void QSqlQuery::setForwardOnly(bool forward). Have you set that true on the direct connection to the MS SQL Server at least?

      A 1 Reply Last reply 20 Apr 2023, 12:25
      1
      • J JonB
        20 Apr 2023, 12:00

        @Andy314
        A vital factor for SQL queries is void QSqlQuery::setForwardOnly(bool forward). Have you set that true on the direct connection to the MS SQL Server at least?

        A Offline
        A Offline
        Andy314
        wrote on 20 Apr 2023, 12:25 last edited by Andy314
        #3

        @JonB said in Database performance 5 times faster with Access than with MS SQL:

        @Andy314
        A vital factor for SQL queries is void QSqlQuery::setForwardOnly(bool forward). Have you set that true on the direct connection to the MS SQL Server at least?

        Oh man, this is really a booster. Now, the direct connection is with 15 sec faster than the Access version. Access itself is with 25 sec faster too.
        Thank you very much for this tip.

        J 1 Reply Last reply 20 Apr 2023, 12:46
        0
        • A Andy314
          20 Apr 2023, 12:25

          @JonB said in Database performance 5 times faster with Access than with MS SQL:

          @Andy314
          A vital factor for SQL queries is void QSqlQuery::setForwardOnly(bool forward). Have you set that true on the direct connection to the MS SQL Server at least?

          Oh man, this is really a booster. Now, the direct connection is with 15 sec faster than the Access version. Access itself is with 25 sec faster too.
          Thank you very much for this tip.

          J Offline
          J Offline
          JonB
          wrote on 20 Apr 2023, 12:46 last edited by JonB
          #4

          @Andy314
          Yep :) I guess you can assume the Access driver maybe does some forward optimization for you, in some shape or form. IIRC the MS SQL driver is the most sensitive to/affected by forward-onlyness, more so than e.g. MySQL. But it's always worth adding Qt's forwardOnly, makes one think maybe it should have been default as there is probably much code out there doing just forward queries and not realizing how much the default is penalising them.

          1 Reply Last reply
          0
          • J JonB referenced this topic on 20 Apr 2023, 19:23
          • A Andy314 has marked this topic as solved on 9 May 2023, 14:23

          1/4

          20 Apr 2023, 11:13

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved