1

I'm using Rails 6 with activerecord-oracle_enhanced-adapter adapter for Oracle 11 XE database. At the beginning of the project I was working with Postgres, but due to customer requirements I had to migrate to Oracle.

My question is very similar to https://stackoverflow.com/questions/592444/rails-rake-dbmigrate-very-slow-on-oracle, but it's from 11 years ago, i'm using the updated version of the adapter.

I know that after all migrations are applied to database then rake db:migrate calls db:schema:dump task to generate schema.rb file from current database schema. I only have one schema, with many tables (around 90)

The answer for the previous question was something like

One way how to debug this issue would be if you would put some debug messages in oracle_enhanced_adapter.rb file so that you could identify which method calls are taking so long time.

== 20200820164111 RemoveSemesterFromProject: migrated (0.1347s) =============== real 13m26,038s user 0m5,494s sys 0m0,401s 

All migrations finished in an reasonable time, so I think the error occurs in the following action "db: schema: dump" but i don't have oracle_enchaced_adapter.rb neither oracle_enhanced_adapter.rb, so i don't know where to look at.

What can i do for improve this behaviour?

Time that takes when i run db:schema:dump

real 9m44,074s user 0m3,701s sys 0m0,327s 

and this is the time that takes when i run db:structure:dump

real 21m40,073s user 0m5,046s sys 0m0,413s 
3
  • Two questions. When did you last analyse the sys schema? How many deleted objects do you have in your database? Commented Aug 27, 2020 at 11:52
  • I'm a bit inexperienced, what do you mean by this analysis? (this is the only project that i have using oracle, if that helps) As for deleted objects, I don't think I understand you well. Can you explain to me what you mean Commented Sep 2, 2020 at 22:37
  • Have a look in the manuals for "analyze schema sys". In some db's, you can drop objects, eg. tables. Problem: Oracle doesn't really drop them. Commented Sep 3, 2020 at 0:21

1 Answer 1

1

This may be a consequence of slow queries issued by activerecord-oracle_enhanced-adapter to determine the database structure, eg. issues/2004

5
  • it seems it could be related, i have the same issue too. Commented Aug 26, 2020 at 19:22
  • Even Oracle had such problems now and then, the sys structures becoming more and more complex, some clients extracting structure information suddenly face long waits. Question is, will Raimonds do something about it? Commented Aug 26, 2020 at 19:45
  • That issue is with Oracle 18, you've got the same problem with 11g-R2 ? Can you tell me how to reproduce it? Commented Aug 26, 2020 at 19:56
  • When I make any query, or when I load data in the view, the console registers that "Column definitions" takes between 6 to 10 ms. Is this the same issue or not? Commented Sep 2, 2020 at 20:27
  • I don't think less than 10ms can be called an issue, no. Commented Sep 3, 2020 at 0:17

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.