Skip to content

Commit 2a6bceb

Browse files
committedMar 5, 2017
Revert "Dynamically adjust postgres feature queue size"
This reverts commit 37a7a22. Leads to performance regressions in some tests
1 parent 4147ead commit 2a6bceb

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed
 

‎src/providers/postgres/qgspostgresfeatureiterator.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222
#include "qgslogger.h"
2323
#include "qgsmessagelog.h"
2424

25-
#include <QElapsedTimer>
2625
#include <QObject>
2726
#include <QSettings>
2827

28+
29+
const int QgsPostgresFeatureIterator::sFeatureQueueSize = 2000;
30+
31+
2932
QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
3033
: QgsAbstractFeatureIteratorFromSource<QgsPostgresFeatureSource>( source, ownSource, request )
31-
, mFeatureQueueSize( 1 )
34+
, mFeatureQueueSize( sFeatureQueueSize )
3235
, mFetched( 0 )
3336
, mFetchGeometry( false )
3437
, mExpressionCompiled( false )
@@ -224,9 +227,6 @@ bool QgsPostgresFeatureIterator::fetchFeature( QgsFeature& feature )
224227

225228
if ( mFeatureQueue.empty() && !mLastFetch )
226229
{
227-
QElapsedTimer timer;
228-
timer.start();
229-
230230
QString fetch = QString( "FETCH FORWARD %1 FROM %2" ).arg( mFeatureQueueSize ).arg( mCursorName );
231231
QgsDebugMsgLevel( QString( "fetching %1 features." ).arg( mFeatureQueueSize ), 4 );
232232

@@ -262,15 +262,6 @@ bool QgsPostgresFeatureIterator::fetchFeature( QgsFeature& feature )
262262
} // for each row in queue
263263
}
264264
unlock();
265-
266-
if ( timer.elapsed() > 500 && mFeatureQueueSize > 1 )
267-
{
268-
mFeatureQueueSize /= 2;
269-
}
270-
else if ( timer.elapsed() < 50 && mFeatureQueueSize < 10000 )
271-
{
272-
mFeatureQueueSize *= 2;
273-
}
274265
}
275266

276267
if ( mFeatureQueue.empty() )

‎src/providers/postgres/qgspostgresfeatureiterator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ class QgsPostgresFeatureIterator : public QgsAbstractFeatureIteratorFromSource<Q
118118

119119
bool mIsTransactionConnection;
120120

121+
static const int sFeatureQueueSize;
122+
121123
private:
122124
//! returns whether the iterator supports simplify geometries on provider side
123125
virtual bool providerCanSimplify( QgsSimplifyMethod::MethodType methodType ) const override;

0 commit comments

Comments
 (0)
Please sign in to comment.