Skip to content
Permalink
Browse files

Revert "Dynamically adjust postgres feature queue size"

This reverts commit 37a7a22.

Leads to performance regressions in some tests
  • Loading branch information
nyalldawson committed Mar 5, 2017
1 parent 4147ead commit 2a6bcebd5edb38b081175d4f664546d6e633d06a
@@ -22,13 +22,16 @@
#include "qgslogger.h"
#include "qgsmessagelog.h"

#include <QElapsedTimer>
#include <QObject>
#include <QSettings>


const int QgsPostgresFeatureIterator::sFeatureQueueSize = 2000;


QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
: QgsAbstractFeatureIteratorFromSource<QgsPostgresFeatureSource>( source, ownSource, request )
, mFeatureQueueSize( 1 )
, mFeatureQueueSize( sFeatureQueueSize )
, mFetched( 0 )
, mFetchGeometry( false )
, mExpressionCompiled( false )
@@ -224,9 +227,6 @@ bool QgsPostgresFeatureIterator::fetchFeature( QgsFeature& feature )

if ( mFeatureQueue.empty() && !mLastFetch )
{
QElapsedTimer timer;
timer.start();

QString fetch = QString( "FETCH FORWARD %1 FROM %2" ).arg( mFeatureQueueSize ).arg( mCursorName );
QgsDebugMsgLevel( QString( "fetching %1 features." ).arg( mFeatureQueueSize ), 4 );

@@ -262,15 +262,6 @@ bool QgsPostgresFeatureIterator::fetchFeature( QgsFeature& feature )
} // for each row in queue
}
unlock();

if ( timer.elapsed() > 500 && mFeatureQueueSize > 1 )
{
mFeatureQueueSize /= 2;
}
else if ( timer.elapsed() < 50 && mFeatureQueueSize < 10000 )
{
mFeatureQueueSize *= 2;
}
}

if ( mFeatureQueue.empty() )
@@ -118,6 +118,8 @@ class QgsPostgresFeatureIterator : public QgsAbstractFeatureIteratorFromSource<Q

bool mIsTransactionConnection;

static const int sFeatureQueueSize;

private:
//! returns whether the iterator supports simplify geometries on provider side
virtual bool providerCanSimplify( QgsSimplifyMethod::MethodType methodType ) const override;

0 comments on commit 2a6bceb

Please sign in to comment.
You can’t perform that action at this time.