Skip to content

Commit

Permalink
remove filters when using precalc sorters; CBO tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
glookka committed Apr 11, 2023
1 parent 3fb9259 commit 6bd9f70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/costestimate.cpp
Expand Up @@ -362,7 +362,7 @@ float CostEstimate_c::CalcQueryCost()
}

if ( iNumFilters )
fCost += CalcFilterCost ( iToIntersect>0, fDocsAfterIndexes );
fCost += CalcFilterCost ( m_tCtx.m_bFromIterator || iToIntersect>0, fDocsAfterIndexes );

if ( iNumLookups )
fCost += CalcLookupCost();
Expand Down
1 change: 1 addition & 0 deletions src/costestimate.h
Expand Up @@ -51,6 +51,7 @@ struct SelectIteratorCtx_t
int64_t m_iTotalDocs = 0;
int m_iThreads = 1;
bool m_bCalcPushCost = true;
bool m_bFromIterator = false;

SelectIteratorCtx_t ( const CSphVector<CSphFilterSettings> & dFilters, const CSphVector<FilterTreeItem_t> & dFilterTree, const CSphVector<IndexHint_t> & dHints, const ISphSchema & tSchema, const HistogramContainer_c * pHistograms, columnar::Columnar_i * pColumnar, SI::Index_i * pSI, ESphCollation eCollation, int iCutoff, int64_t iTotalDocs, int iThreads );

Expand Down
5 changes: 4 additions & 1 deletion src/sphinx.cpp
Expand Up @@ -8002,6 +8002,7 @@ bool CSphIndex_VLN::SelectIteratorsFT ( const CSphQuery & tQuery, ISphRanker * p
i.m_iRsetEstimate *= fRatio;

tSelectIteratorCtx.m_iTotalDocs = tEstimate.m_iDocs;
tSelectIteratorCtx.m_bFromIterator = true;
std::unique_ptr<CostEstimate_i> pCostEstimate ( CreateCostEstimate ( dSIInfoFilters, tSelectIteratorCtx ) );
fCostOfFilters = pCostEstimate->CalcQueryCost();
}
Expand Down Expand Up @@ -8190,7 +8191,9 @@ bool CSphIndex_VLN::MultiScan ( CSphQueryResult & tResult, const CSphQuery & tQu
// try to spawn an iterator from a secondary index
CSphVector<CSphFilterSettings> dModifiedFilters; // holds filter settings if they were modified. filters hold pointers to those settings
std::unique_ptr<RowidIterator_i> pIterator;
if ( !bAllPrecalc )
if ( bAllPrecalc )
tCtx.m_pFilter.reset();
else
pIterator = std::unique_ptr<RowidIterator_i> ( SpawnIterators ( tQuery, tCtx, tFlx, tMaxSorterSchema, tMeta, iCutoff, tArgs.m_iTotalThreads, dModifiedFilters, nullptr ) );

SwitchProfile ( tMeta.m_pProfile, SPH_QSTATE_FULLSCAN );
Expand Down

0 comments on commit 6bd9f70

Please sign in to comment.