Skip to content

Commit

Permalink
[oracle] Prefetch memory variable changed to 32-bit and default raise…
Browse files Browse the repository at this point in the history
…d to 8MB

Speeds up oracle table access by orders of magnitude

(cherry picked from commit c3e7632)
  • Loading branch information
bjornharrtell authored and nyalldawson committed Oct 30, 2018
1 parent fe8875c commit ac1fa9e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/providers/oracle/ocispatial/qsql_ocispatial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
#include <cstdlib>

#define QOCISPATIAL_DYNAMIC_CHUNK_SIZE 65535
#define QOCISPATIAL_PREFETCH_MEM 10240
#define QOCISPATIAL_PREFETCH_ROWS 10000
#define QOCISPATIAL_PREFETCH_MEM 8388608 // 8MB

// setting this define will allow using a query from a different
// thread than its database connection.
Expand Down Expand Up @@ -341,8 +342,8 @@ class QOCISpatialDriverPrivate : public QSqlDriverPrivate
OCIError *err = nullptr;
bool transaction = false;
int serverVersion = -1;
ub4 prefetchRows = 0xffffffff;
ub2 prefetchMem = QOCISPATIAL_PREFETCH_MEM;
ub4 prefetchRows = QOCISPATIAL_PREFETCH_ROWS;
ub4 prefetchMem = QOCISPATIAL_PREFETCH_MEM;
QString user;

OCIType *geometryTDO = nullptr;
Expand Down Expand Up @@ -429,7 +430,7 @@ class QOCISpatialResultPrivate: public QSqlCachedResultPrivate
QList<QOCISDOGeometryInd *> sdoind;
bool transaction;
int serverVersion;
int prefetchRows, prefetchMem;
ub4 prefetchRows, prefetchMem;
OCIType *geometryTDO = nullptr;
QOCISDOGeometryObj *geometryObj = nullptr;
QOCISDOGeometryInd *geometryInd = nullptr;
Expand Down Expand Up @@ -3833,13 +3834,13 @@ static void qParseOpts( const QString &options, QOCISpatialDriverPrivate *d )
{
d->prefetchRows = val.toInt( &ok );
if ( !ok )
d->prefetchRows = 0xffffffff;
d->prefetchRows = QOCISPATIAL_PREFETCH_ROWS;
}
else if ( opt == QLatin1String( "OCI_ATTR_PREFETCH_MEMORY" ) )
{
d->prefetchMem = val.toInt( &ok );
if ( !ok )
d->prefetchMem = 0xffff;
d->prefetchMem = QOCISPATIAL_PREFETCH_MEM;
}
else
{
Expand Down

0 comments on commit ac1fa9e

Please sign in to comment.