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. How fetching data from MSSQL can be increased>
Qt 6.11 is out! See what's new in the release blog

How fetching data from MSSQL can be increased>

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 3 Posters 982 Views
  • 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.
  • M.H.HM Offline
    M.H.HM Offline
    M.H.H
    wrote on last edited by
    #1

    Hi there,

    The speed of fetching data from SQLite is significantly more than MSSQL.
    Is there any way to increase fetching data speed on the MSSQL connection?

    JonBJ 1 Reply Last reply
    0
    • M.H.HM M.H.H

      Hi there,

      The speed of fetching data from SQLite is significantly more than MSSQL.
      Is there any way to increase fetching data speed on the MSSQL connection?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @M-H-H
      SQLite only has to fetch directly from a file. MSSQL requires using a server process. So there is bound to be some overhead. And you may be using the ODBC connection to MSSQL, which won't be as fast as a SQL Native Client?

      1 Reply Last reply
      2
      • M.H.HM Offline
        M.H.HM Offline
        M.H.H
        wrote on last edited by
        #3

        Thanks for replying,
        I used ODBC and it is slow. I didn't find any example for SQL Native Client. ( Qt does not support this type of connection. )

        JonBJ 1 Reply Last reply
        0
        • M.H.HM M.H.H

          Thanks for replying,
          I used ODBC and it is slow. I didn't find any example for SQL Native Client. ( Qt does not support this type of connection. )

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @M-H-H said in How fetching data from MSSQL can be increased>:

          I used ODBC and it is slow. I didn't find any example for SQL Native Client. ( Qt does not support this type of connection. )

          I am aware of this! I just drew your attention to the fact that ODBC is likely slower than SQL Native Client would be, and hence a possible factor in your tests, though you can't alter that from Qt.

          One obvious observation might be: if speed is a concern, why use MSSQL if you are on a single PC? And if you are using it across a network, then it might well be faster, and at least more secure, than SQLite?

          BTW, are you using the "forward only" parameter where you can, e.g. doing SELECTs? I found this had a considerable speed up at least for MySQL, if you're not using where appropriate for MSSQL it's worth a try to see if you improve?

          M.H.HM 1 Reply Last reply
          1
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Use another database like e.g. PostgreSQL which is better supported will maybe help :)

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            M.H.HM 1 Reply Last reply
            1
            • JonBJ JonB

              @M-H-H said in How fetching data from MSSQL can be increased>:

              I used ODBC and it is slow. I didn't find any example for SQL Native Client. ( Qt does not support this type of connection. )

              I am aware of this! I just drew your attention to the fact that ODBC is likely slower than SQL Native Client would be, and hence a possible factor in your tests, though you can't alter that from Qt.

              One obvious observation might be: if speed is a concern, why use MSSQL if you are on a single PC? And if you are using it across a network, then it might well be faster, and at least more secure, than SQLite?

              BTW, are you using the "forward only" parameter where you can, e.g. doing SELECTs? I found this had a considerable speed up at least for MySQL, if you're not using where appropriate for MSSQL it's worth a try to see if you improve?

              M.H.HM Offline
              M.H.HM Offline
              M.H.H
              wrote on last edited by
              #6

              @JonB
              I use 'where' in my SQL script to speed up and reduce the amounts of records that are required. Actually, the SQL command runs very fast but getting the result in a loop is the problem. For example, in C# you can get the result in bulk which helps to reduce the overhead.
              Also, I use indexing to improve the performance which helps a lot.

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Blame the ODBC driver :)

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  Use another database like e.g. PostgreSQL which is better supported will maybe help :)

                  M.H.HM Offline
                  M.H.HM Offline
                  M.H.H
                  wrote on last edited by
                  #8

                  @Christian-Ehrlicher
                  Thanks for your mention.
                  I might check MySQL instead of PostgreSQL.

                  Christian EhrlicherC 1 Reply Last reply
                  0
                  • M.H.HM M.H.H

                    @Christian-Ehrlicher
                    Thanks for your mention.
                    I might check MySQL instead of PostgreSQL.

                    Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by Christian Ehrlicher
                    #9

                    @M-H-H But then you have to compile the Qt plugin by your own due to licensing issues. Use a database where you don't have such problems.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    M.H.HM 1 Reply Last reply
                    1
                    • Christian EhrlicherC Christian Ehrlicher

                      @M-H-H But then you have to compile the Qt plugin by your own due to licensing issues. Use a database where you don't have such problems.

                      M.H.HM Offline
                      M.H.HM Offline
                      M.H.H
                      wrote on last edited by
                      #10

                      @Christian-Ehrlicher
                      Indeed.👍

                      JonBJ 1 Reply Last reply
                      0
                      • M.H.HM M.H.H

                        @Christian-Ehrlicher
                        Indeed.👍

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #11

                        @M-H-H
                        As I said, at least try void QSqlQuery::setForwardOnly(bool forward). With any driver.

                        1 Reply Last reply
                        1

                        • Login

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