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

  • Two questions. When did you last analyse the sys schema? How many deleted objects do you have in your database? – Gerard H. Pille Aug 27 '20 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 – Grizz Sep 2 '20 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. – Gerard H. Pille Sep 3 '20 at 0:21

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

  • it seems it could be related, i have the same issue too. – Grizz Aug 26 '20 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? – Gerard H. Pille Aug 26 '20 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? – Gerard H. Pille Aug 26 '20 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? – Grizz Sep 2 '20 at 20:27
  • I don't think less than 10ms can be called an issue, no. – Gerard H. Pille Sep 3 '20 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.