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.
  • Everton FonsecaE Offline
    Everton FonsecaE Offline
    Everton Fonseca
    wrote on 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
    • Everton FonsecaE Offline
      Everton FonsecaE Offline
      Everton Fonseca
      wrote on 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
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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

        Everton FonsecaE 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

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

          Everton FonsecaE Offline
          Everton FonsecaE Offline
          Everton Fonseca
          wrote on last edited by
          #4

          @SGaist no

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on 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

            Everton FonsecaE 2 Replies Last reply
            3
            • SGaistS SGaist

              Then it might be a good idea to do so.

              Everton FonsecaE Offline
              Everton FonsecaE Offline
              Everton Fonseca
              wrote on last edited by
              #6

              @SGaist ok

              1 Reply Last reply
              0
              • SGaistS SGaist

                Then it might be a good idea to do so.

                Everton FonsecaE Offline
                Everton FonsecaE Offline
                Everton Fonseca
                wrote on last edited by
                #7

                @SGaist how can i do it?

                mrjjM 1 Reply Last reply
                0
                • Everton FonsecaE Everton Fonseca

                  @SGaist how can i do it?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 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"

                  Everton FonsecaE 1 Reply Last reply
                  2
                  • mrjjM mrjj

                    @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"

                    Everton FonsecaE Offline
                    Everton FonsecaE Offline
                    Everton Fonseca
                    wrote on last edited by
                    #9

                    @mrjj I did it

                    mrjjM 1 Reply Last reply
                    0
                    • Everton FonsecaE Everton Fonseca

                      @mrjj I did it

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Everton-Fonseca
                      and did it help ?

                      Everton FonsecaE 2 Replies Last reply
                      0
                      • mrjjM mrjj

                        @Everton-Fonseca
                        and did it help ?

                        Everton FonsecaE Offline
                        Everton FonsecaE Offline
                        Everton Fonseca
                        wrote on last edited by
                        #11

                        @mrjj yet it isn't working

                        1 Reply Last reply
                        1
                        • mrjjM mrjj

                          @Everton-Fonseca
                          and did it help ?

                          Everton FonsecaE Offline
                          Everton FonsecaE Offline
                          Everton Fonseca
                          wrote on 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

                          mrjjM 1 Reply Last reply
                          0
                          • Everton FonsecaE Everton Fonseca

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

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 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

                            • Login

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