Class: OCI::DatabaseManagement::Models::SqlPlanBaseline

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/database_management/models/sql_plan_baseline.rb

Overview

The details of a SQL plan baseline.

Constant Summary collapse

ORIGIN_ENUM =
[
  ORIGIN_ADDM_SQLTUNE = 'ADDM_SQLTUNE'.freeze,
  ORIGIN_AUTO_CAPTURE = 'AUTO_CAPTURE'.freeze,
  ORIGIN_AUTO_SQLTUNE = 'AUTO_SQLTUNE'.freeze,
  ORIGIN_EVOLVE_AUTO_INDEX_LOAD = 'EVOLVE_AUTO_INDEX_LOAD'.freeze,
  ORIGIN_EVOLVE_CREATE_FROM_ADAPTIVE = 'EVOLVE_CREATE_FROM_ADAPTIVE'.freeze,
  ORIGIN_EVOLVE_LOAD_FROM_STS = 'EVOLVE_LOAD_FROM_STS'.freeze,
  ORIGIN_EVOLVE_LOAD_FROM_AWR = 'EVOLVE_LOAD_FROM_AWR'.freeze,
  ORIGIN_EVOLVE_LOAD_FROM_CURSOR_CACHE = 'EVOLVE_LOAD_FROM_CURSOR_CACHE'.freeze,
  ORIGIN_MANUAL_LOAD = 'MANUAL_LOAD'.freeze,
  ORIGIN_MANUAL_LOAD_FROM_AWR = 'MANUAL_LOAD_FROM_AWR'.freeze,
  ORIGIN_MANUAL_LOAD_FROM_CURSOR_CACHE = 'MANUAL_LOAD_FROM_CURSOR_CACHE'.freeze,
  ORIGIN_MANUAL_LOAD_FROM_STS = 'MANUAL_LOAD_FROM_STS'.freeze,
  ORIGIN_MANUAL_SQLTUNE = 'MANUAL_SQLTUNE'.freeze,
  ORIGIN_STORED_OUTLINE = 'STORED_OUTLINE'.freeze,
  ORIGIN_UNKNOWN = 'UNKNOWN'.freeze,
  ORIGIN_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SqlPlanBaseline

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :plan_name (String)

    The value to assign to the #plan_name property

  • :sql_handle (String)

    The value to assign to the #sql_handle property

  • :sql_text (String)

    The value to assign to the #sql_text property

  • :origin (String)

    The value to assign to the #origin property

  • :time_created (DateTime)

    The value to assign to the #time_created property

  • :time_last_modified (DateTime)

    The value to assign to the #time_last_modified property

  • :time_last_executed (DateTime)

    The value to assign to the #time_last_executed property

  • :enabled (String)

    The value to assign to the #enabled property

  • :accepted (String)

    The value to assign to the #accepted property

  • :fixed (String)

    The value to assign to the #fixed property

  • :reproduced (String)

    The value to assign to the #reproduced property

  • :auto_purge (String)

    The value to assign to the #auto_purge property

  • :adaptive (String)

    The value to assign to the #adaptive property

  • :_module (String)

    The value to assign to the #_module property

  • :action (String)

    The value to assign to the #action property

  • :execution_plan (String)

    The value to assign to the #execution_plan property



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 180

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.plan_name = attributes[:'planName'] if attributes[:'planName']

  raise 'You cannot provide both :planName and :plan_name' if attributes.key?(:'planName') && attributes.key?(:'plan_name')

  self.plan_name = attributes[:'plan_name'] if attributes[:'plan_name']

  self.sql_handle = attributes[:'sqlHandle'] if attributes[:'sqlHandle']

  raise 'You cannot provide both :sqlHandle and :sql_handle' if attributes.key?(:'sqlHandle') && attributes.key?(:'sql_handle')

  self.sql_handle = attributes[:'sql_handle'] if attributes[:'sql_handle']

  self.sql_text = attributes[:'sqlText'] if attributes[:'sqlText']

  raise 'You cannot provide both :sqlText and :sql_text' if attributes.key?(:'sqlText') && attributes.key?(:'sql_text')

  self.sql_text = attributes[:'sql_text'] if attributes[:'sql_text']

  self.origin = attributes[:'origin'] if attributes[:'origin']

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

  raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')

  self.time_created = attributes[:'time_created'] if attributes[:'time_created']

  self.time_last_modified = attributes[:'timeLastModified'] if attributes[:'timeLastModified']

  raise 'You cannot provide both :timeLastModified and :time_last_modified' if attributes.key?(:'timeLastModified') && attributes.key?(:'time_last_modified')

  self.time_last_modified = attributes[:'time_last_modified'] if attributes[:'time_last_modified']

  self.time_last_executed = attributes[:'timeLastExecuted'] if attributes[:'timeLastExecuted']

  raise 'You cannot provide both :timeLastExecuted and :time_last_executed' if attributes.key?(:'timeLastExecuted') && attributes.key?(:'time_last_executed')

  self.time_last_executed = attributes[:'time_last_executed'] if attributes[:'time_last_executed']

  self.enabled = attributes[:'enabled'] if attributes[:'enabled']

  self.accepted = attributes[:'accepted'] if attributes[:'accepted']

  self.fixed = attributes[:'fixed'] if attributes[:'fixed']

  self.reproduced = attributes[:'reproduced'] if attributes[:'reproduced']

  self.auto_purge = attributes[:'autoPurge'] if attributes[:'autoPurge']

  raise 'You cannot provide both :autoPurge and :auto_purge' if attributes.key?(:'autoPurge') && attributes.key?(:'auto_purge')

  self.auto_purge = attributes[:'auto_purge'] if attributes[:'auto_purge']

  self.adaptive = attributes[:'adaptive'] if attributes[:'adaptive']

  self._module = attributes[:'module'] if attributes[:'module']

  raise 'You cannot provide both :module and :_module' if attributes.key?(:'module') && attributes.key?(:'_module')

  self._module = attributes[:'_module'] if attributes[:'_module']

  self.action = attributes[:'action'] if attributes[:'action']

  self.execution_plan = attributes[:'executionPlan'] if attributes[:'executionPlan']

  raise 'You cannot provide both :executionPlan and :execution_plan' if attributes.key?(:'executionPlan') && attributes.key?(:'execution_plan')

  self.execution_plan = attributes[:'execution_plan'] if attributes[:'execution_plan']
end

Instance Attribute Details

#_moduleString

The application module name.

Returns:

  • (String)


100
101
102
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 100

def _module
  @_module
end

#acceptedString

Indicates whether the plan baseline is accepted (YES) or not (NO).

Returns:

  • (String)


70
71
72
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 70

def accepted
  @accepted
end

#actionString

The application action.

Returns:

  • (String)


104
105
106
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 104

def action
  @action
end

#adaptiveString

Indicates whether a plan that is automatically captured by SQL plan management is marked adaptive or not.

When a new adaptive plan is found for a SQL statement that has an existing SQL plan baseline, that new plan will be added to the SQL plan baseline as an unaccepted plan, and the ADAPTIVE property will be marked YES. When this new plan is verified (either manually or via the auto evolve task), the plan will be test executed and the final plan determined at execution will become an accepted plan if its performance is better than the existing plan baseline. At this point, the value of the ADAPTIVE property is set to NO since the plan is no longer adaptive, but resolved.

Returns:

  • (String)


96
97
98
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 96

def adaptive
  @adaptive
end

#auto_purgeString

Indicates whether the plan baseline is auto-purged (YES) or not (NO).

Returns:

  • (String)


84
85
86
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 84

def auto_purge
  @auto_purge
end

#enabledString

Indicates whether the plan baseline is enabled (YES) or disabled (NO).

Returns:

  • (String)


66
67
68
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 66

def enabled
  @enabled
end

#execution_planString

[Required] The execution plan for the SQL statement.

Returns:

  • (String)


108
109
110
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 108

def execution_plan
  @execution_plan
end

#fixedString

Indicates whether the plan baseline is fixed (YES) or not (NO).

Returns:

  • (String)


74
75
76
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 74

def fixed
  @fixed
end

#originString

The origin of the SQL plan baseline.

Returns:

  • (String)


45
46
47
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 45

def origin
  @origin
end

#plan_nameString

[Required] The unique plan identifier.

Returns:

  • (String)


33
34
35
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 33

def plan_name
  @plan_name
end

#reproducedString

Indicates whether the optimizer was able to reproduce the plan (YES) or not (NO). The value is set to YES when a plan is initially added to the plan baseline.

Returns:

  • (String)


80
81
82
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 80

def reproduced
  @reproduced
end

#sql_handleString

[Required] The unique SQL identifier.

Returns:

  • (String)


37
38
39
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 37

def sql_handle
  @sql_handle
end

#sql_textString

[Required] The SQL text.

Returns:

  • (String)


41
42
43
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 41

def sql_text
  @sql_text
end

#time_createdDateTime

[Required] The date and time when the plan baseline was created.

Returns:

  • (DateTime)


49
50
51
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 49

def time_created
  @time_created
end

#time_last_executedDateTime

The date and time when the plan baseline was last executed.

Note: For performance reasons, database does not update this value immediately after each execution of the plan baseline. Therefore, the plan baseline may have been executed more recently than this value indicates.

Returns:

  • (DateTime)


62
63
64
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 62

def time_last_executed
  @time_last_executed
end

#time_last_modifiedDateTime

The date and time when the plan baseline was last modified.

Returns:

  • (DateTime)


53
54
55
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 53

def time_last_modified
  @time_last_modified
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 111

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'plan_name': :'planName',
    'sql_handle': :'sqlHandle',
    'sql_text': :'sqlText',
    'origin': :'origin',
    'time_created': :'timeCreated',
    'time_last_modified': :'timeLastModified',
    'time_last_executed': :'timeLastExecuted',
    'enabled': :'enabled',
    'accepted': :'accepted',
    'fixed': :'fixed',
    'reproduced': :'reproduced',
    'auto_purge': :'autoPurge',
    'adaptive': :'adaptive',
    '_module': :'module',
    'action': :'action',
    'execution_plan': :'executionPlan'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 135

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'plan_name': :'String',
    'sql_handle': :'String',
    'sql_text': :'String',
    'origin': :'String',
    'time_created': :'DateTime',
    'time_last_modified': :'DateTime',
    'time_last_executed': :'DateTime',
    'enabled': :'String',
    'accepted': :'String',
    'fixed': :'String',
    'reproduced': :'String',
    'auto_purge': :'String',
    'adaptive': :'String',
    '_module': :'String',
    'action': :'String',
    'execution_plan': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 275

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    plan_name == other.plan_name &&
    sql_handle == other.sql_handle &&
    sql_text == other.sql_text &&
    origin == other.origin &&
    time_created == other.time_created &&
    time_last_modified == other.time_last_modified &&
    time_last_executed == other.time_last_executed &&
    enabled == other.enabled &&
    accepted == other.accepted &&
    fixed == other.fixed &&
    reproduced == other.reproduced &&
    auto_purge == other.auto_purge &&
    adaptive == other.adaptive &&
    _module == other._module &&
    action == other.action &&
    execution_plan == other.execution_plan
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 320

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


300
301
302
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 300

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



309
310
311
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 309

def hash
  [plan_name, sql_handle, sql_text, origin, time_created, time_last_modified, time_last_executed, enabled, accepted, fixed, reproduced, auto_purge, adaptive, _module, action, execution_plan].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



353
354
355
356
357
358
359
360
361
362
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 353

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



347
348
349
# File 'lib/oci/database_management/models/sql_plan_baseline.rb', line 347

def to_s
  to_hash.to_s
end