Questions tagged [rails]
Rails is a cross-platform model-view-controller-centric application framework for Ruby. Use this tag for database-related Rails questions.
46 questions
1 vote
1 answer
381 views
Can I optimize UPDATE statements using EXPLAIN?
I have a few UPDATE calls on my production system that are running slow and I've been instructed to try and optimize them. I'm reading into how to understand EXPLAIN with (ANALYZE, BUFFERS) as well to ...
0 votes
1 answer
86 views
Recommended way to build database to contain users and chatgpt data
I am looking to create a Rails application to interface between users and Azure ChatGPT. I will include my ERD diagram showing a couple of options in building the database tables and table ...
0 votes
0 answers
39 views
Managed database or docker image with data-volume?
I've mostly used managed database (AWS RDS) for production. I was fiddling with docker and was wondering if it's a good idea to have containerised postgres database with data-volume? I feel it may not ...
0 votes
0 answers
267 views
How does JDBC over LDAP connection work?
The JDBC connection I should use is defined in Oracle SQL Developer with the following syntax: jdbc:oracle:thin:@ldap://intranet.oid-01.dama.ch:3063/EDWHPD,cn=OracleContext,dc=emea,dc=dama,dc=ch But ...
0 votes
0 answers
108 views
How to connect to Oracle through LDAP with Ruby on Rails 5.4.2?
My application is running on Rails 5.4.2/Ruby 2.7 and relies on an Oracle 19c. I used to query an Oracle database through a classical OCI connection configuration: config/database.yml development: ...
1 vote
0 answers
48 views
Migrations spreading to the wrong database (local environment)
I am working on one Flask project and one Ruby on Rails project, both using Postgres. When I migrate in Rails, the changes are implemented both in this database and in the database for the Flask ...
1 vote
0 answers
51 views
Is creating table entry from another table entry and copying its value good practices?
Lets say I have inventory_receives table which contain many inventory_receive_entry and also I have inventory table which contain one inventory_receive_entry Then in my application inventory_receives ...
1 vote
0 answers
279 views
Extremely slow updates to small Oracle table from rails app (oracle r12 and r19)
I'm not sure if this is a rails issue, or a database issue, but as this seems to be a schema specific issue, I'm looking at it from the database side first. (Other customers with the same setup on ...
1 vote
1 answer
3k views
PostgreSQL update table then insert on another table
I have a User table and a Log table. I need to update a field on the User table and insert a new entry on the Log table recording the update. I have written the statement for the update: UPDATE ...
1 vote
1 answer
510 views
Why is the schema/structure dump so slow? [closed]
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 ...
0 votes
1 answer
58 views
Multiple Joins with Sums
Here is my basic schema wbs_item +----+-----------+-----------+ | id | name | parent_id | +----+-----------+-----------+ | 1 | Materials | | +----+-----------+-----------+ | 2 | ...
0 votes
0 answers
778 views
Postgres INSERT slows down over time until server is restarted
I have a Rails app backed by an Azure-managed Postgres database and I use NewRelic for monitoring. What I've noticed is that the INSERT performance degrades almost linearly over time - what started ...
-4 votes
1 answer
3k views
Postgres is Throwing a False Foreign Key Constraint Violation? [closed]
I am trying to delete a LocalTax record from Postgres. Currently, I don't think there are any Employee records that reference the LocalTax in question (8). => SELECT COUNT(*) FROM employees WHERE ...
1 vote
2 answers
606 views
MySQL failover: how application can be switched to a new master in master-slave configuration?
In my case I have two MySQL servers. One is master and second one is slave. When slave is not available, my application can read and write from/to master. When master is not available, assume there ...
1 vote
1 answer
2k views
PostgreSQL query suddenly very slow after new column addition
I have a query that's performing terribly after adding a new column. Here's the slow version: SELECT COUNT(*) FROM activities INNER JOIN "users" ON "users"."id" = "activities"."user_id" AND "users"."...