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. Why QSqlDatabase db QOCI very slow when QSqlQuery is calling next() function ?
Forum Updated to NodeBB v4.3 + New Features

Why QSqlDatabase db QOCI very slow when QSqlQuery is calling next() function ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 3 Posters 1.9k 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.
  • E Offline
    E Offline
    Everton Fonseca
    wrote on 22 Feb 2019, 19:30 last edited by
    #1

    Driver Oracle 12g

    QSqlDatabase db = QSqlDatabase::addDatabase("QOCI");
    db.setUserName("bomfuturo_dev");
    db.setHostName("#########");
    db.setPassword("#########");
    db.setDatabaseName("AGMQAS");
    db.setPort(1521);
    db.setConnectOptions("OCI_ATTR_PREFETCH_ROWS=1000;OCI_ATTR_PREFETCH_MEMORY=1000");
    db.open();

                QSqlQuery rs(db);
                rs.setForwardOnly(true);
                if(rs.exec(query)){
    
                    while(rs.next()) -----> it's very slow 
                    {
                       qDebug() <<"dado" <<  rs.value(0).toString();
                    }
                }
    
    1 Reply Last reply
    0
    • E Offline
      E Offline
      Everton Fonseca
      wrote on 22 Feb 2019, 19:32 last edited by
      #2

      I've encountered someone else with the same problem I'm having
      link: https://bugreports.qt.io/browse/QTBUG-27098

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 22 Feb 2019, 21:19 last edited by
        #3

        Hi,

        Did you try to use the fix provided in bug report ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        E 1 Reply Last reply 23 Feb 2019, 00:26
        1
        • S SGaist
          22 Feb 2019, 21:19

          Hi,

          Did you try to use the fix provided in bug report ?

          E Offline
          E Offline
          Everton Fonseca
          wrote on 23 Feb 2019, 00:26 last edited by
          #4

          @SGaist no

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 23 Feb 2019, 09:50 last edited by
            #5

            Then it might be a good idea to do so.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            E 2 Replies Last reply 24 Feb 2019, 00:33
            3
            • S SGaist
              23 Feb 2019, 09:50

              Then it might be a good idea to do so.

              E Offline
              E Offline
              Everton Fonseca
              wrote on 24 Feb 2019, 00:33 last edited by
              #6

              @SGaist ok

              1 Reply Last reply
              0
              • S SGaist
                23 Feb 2019, 09:50

                Then it might be a good idea to do so.

                E Offline
                E Offline
                Everton Fonseca
                wrote on 24 Feb 2019, 00:36 last edited by
                #7

                @SGaist how can i do it?

                M 1 Reply Last reply 24 Feb 2019, 08:13
                0
                • E Everton Fonseca
                  24 Feb 2019, 00:36

                  @SGaist how can i do it?

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 24 Feb 2019, 08:13 last edited by
                  #8

                  @Everton-Fonseca
                  HI
                  The bug comments says
                  "Resolution: This issue was resolved by set OCI_ATTR_PREFETCH_ROWS and/or OCI_ATTR_PREFETCH_MEMORY parameter with SqlDatabase::setConnectOptions() function."

                  so use
                  https://doc.qt.io/qt-5/qsqldatabase.html#setConnectOptions

                  and try with
                  setConnectOptions("OCI_ATTR_PREFETCH_ROWS;OCI_ATTR_PREFETCH_MEMORY"

                  E 1 Reply Last reply 24 Feb 2019, 09:51
                  2
                  • M mrjj
                    24 Feb 2019, 08:13

                    @Everton-Fonseca
                    HI
                    The bug comments says
                    "Resolution: This issue was resolved by set OCI_ATTR_PREFETCH_ROWS and/or OCI_ATTR_PREFETCH_MEMORY parameter with SqlDatabase::setConnectOptions() function."

                    so use
                    https://doc.qt.io/qt-5/qsqldatabase.html#setConnectOptions

                    and try with
                    setConnectOptions("OCI_ATTR_PREFETCH_ROWS;OCI_ATTR_PREFETCH_MEMORY"

                    E Offline
                    E Offline
                    Everton Fonseca
                    wrote on 24 Feb 2019, 09:51 last edited by
                    #9

                    @mrjj I did it

                    M 1 Reply Last reply 24 Feb 2019, 10:24
                    0
                    • E Everton Fonseca
                      24 Feb 2019, 09:51

                      @mrjj I did it

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 24 Feb 2019, 10:24 last edited by
                      #10

                      @Everton-Fonseca
                      and did it help ?

                      E 2 Replies Last reply 24 Feb 2019, 21:44
                      0
                      • M mrjj
                        24 Feb 2019, 10:24

                        @Everton-Fonseca
                        and did it help ?

                        E Offline
                        E Offline
                        Everton Fonseca
                        wrote on 24 Feb 2019, 21:44 last edited by
                        #11

                        @mrjj yet it isn't working

                        1 Reply Last reply
                        1
                        • M mrjj
                          24 Feb 2019, 10:24

                          @Everton-Fonseca
                          and did it help ?

                          E Offline
                          E Offline
                          Everton Fonseca
                          wrote on 24 Feb 2019, 21:45 last edited by
                          #12

                          @mrjj look at example db.setConnectOptions("OCI_ATTR_PREFETCH_ROWS=1000;OCI_ATTR_PREFETCH_MEMORY=1000");
                          it was before open database

                          M 1 Reply Last reply 24 Feb 2019, 21:55
                          0
                          • E Everton Fonseca
                            24 Feb 2019, 21:45

                            @mrjj look at example db.setConnectOptions("OCI_ATTR_PREFETCH_ROWS=1000;OCI_ATTR_PREFETCH_MEMORY=1000");
                            it was before open database

                            M Offline
                            M Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 24 Feb 2019, 21:55 last edited by
                            #13

                            @Everton-Fonseca
                            ok. odd. the poster said it fixed it for him.
                            Other poster said ODBC worked better for him.

                            1 Reply Last reply
                            0

                            1/13

                            22 Feb 2019, 19:30

                            • Login

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