MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / generateRetrieval

Method generateRetrieval

src/jrd/optimizer/Optimizer.cpp:3011–3200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3009//
3010
3011RecordSource* Optimizer::generateRetrieval(StreamType stream,
3012 SortNode** sortClause,
3013 bool outerFlag,
3014 bool innerFlag,
3015 BoolExprNode** returnBoolean)
3016{
3017 const auto tail = &csb->csb_rpt[stream];
3018 const auto relation = tail->csb_relation;
3019 fb_assert(relation);
3020
3021 const string alias = makeAlias(stream);
3022 tail->activate();
3023
3024 // Time to find inversions. For each index on the relation
3025 // match all unused booleans against the index looking for upper
3026 // and lower bounds that can be computed by the index. When
3027 // all unused conjunctions are exhausted, see if there is enough
3028 // information for an index retrieval. If so, build up an
3029 // inversion component of the boolean.
3030
3031 RecordSource* rsb = nullptr;
3032 InversionNode* inversion = nullptr;
3033 BoolExprNode* condition = nullptr;
3034 Array<DbKeyRangeNode*> dbkeyRanges;
3035 double scanSelectivity = MAXIMUM_SELECTIVITY;
3036
3037 if (relation->rel_file)
3038 {
3039 // External table
3040 rsb = FB_NEW_POOL(getPool()) ExternalTableScan(csb, alias, stream, relation);
3041 }
3042 else if (relation->isVirtual())
3043 {
3044 // Virtual table: monitoring or security
3045 switch (relation->rel_id)
3046 {
3047 case rel_global_auth_mapping:
3048 rsb = FB_NEW_POOL(getPool()) GlobalMappingScan(csb, alias, stream, relation);
3049 break;
3050
3051 case rel_sec_users:
3052 case rel_sec_user_attributes:
3053 rsb = FB_NEW_POOL(getPool()) UsersTableScan(csb, alias, stream, relation);
3054 break;
3055
3056 case rel_sec_db_creators:
3057 rsb = FB_NEW_POOL(getPool()) DbCreatorsScan(csb, alias, stream, relation);
3058 break;
3059
3060 case rel_time_zones:
3061 rsb = FB_NEW_POOL(getPool()) TimeZonesTableScan(csb, alias, stream, relation);
3062 break;
3063
3064 case rel_config:
3065 rsb = FB_NEW_POOL(getPool()) ConfigTableScan(csb, alias, stream, relation);
3066 break;
3067
3068 case rel_keywords:

Callers 1

formRiverMethod · 0.80

Calls 15

ExternalTableScanClass · 0.85
GlobalMappingScanClass · 0.85
UsersTableScanClass · 0.85
DbCreatorsScanClass · 0.85
TimeZonesTableScanClass · 0.85
ConfigTableScanClass · 0.85
KeywordsTableScanClass · 0.85
MonitoringTableScanClass · 0.85
composeFunction · 0.85
FullTableScanClass · 0.85
BitmapTableScanClass · 0.85
ConditionalStreamClass · 0.85

Tested by

no test coverage detected