Skip to content

Very long requests "Column definitions" before main sql request. #2004

Open
@vitalyliber

Description

@vitalyliber

Steps to reproduce

When I start rails server I and try to do make an Active Record request to DB I have very slow executions named as "Column definitions". It can take between 10 to 20 seconds. Sometimes "Column definitions" it happens twice.

Expected behavior

This should work faster.

Actual behavior

I see very long requests before execute the main request:

Column definitions (10458.9ms) SELECT cols.column_name AS name, cols.data_type AS sql_type, cols.data_default, cols.nullable, cols.virtual_column, cols.hidden_column, cols.data_type_owner AS sql_type_owner, DECODE(cols.data_type, 'NUMBER', data_precision, 'FLOAT', data_precision, 'VARCHAR2', DECODE(char_used, 'C', char_length, data_length), 'RAW', DECODE(char_used, 'C', char_length, data_length), 'CHAR', DECODE(char_used, 'C', char_length, data_length), NULL) AS limit, DECODE(data_type, 'NUMBER', data_scale, NULL) AS scale, comments.comments as column_comment FROM all_tab_cols cols, all_col_comments comments WHERE cols.owner = 'PORTAL_DB' AND cols.table_name = 'ORDER_PURCHASE_V' AND cols.hidden_column = 'NO' AND cols.owner = comments.owner AND cols.table_name = comments.table_name AND cols.column_name = comments.column_name ORDER BY cols.column_id

System configuration

Rails version: 6.0.2.1

Oracle enhanced adapter version:

Ruby version: 2.7.0

Oracle Database version: 18.4.0.0.0

I think it can be related with Oracle Views - I connected them like a models:

class Supplier < ApplicationRecord
  self.table_name = 'supplier_v'
  self.primary_key = :supplier_id

  attribute :supplier_id, :integer
  attribute :axapta_id, :string
  attribute :supplier_name, :string
  attribute :supplier_inn, :string
  attribute :file_id, :integer
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions