Hugo Ramos
Hugo Ramos

Reputation: 165

RDS Aurora (MySQL) performing EXTREMELY poorly

I'm migrating our Amazon RDS MsSQL database to RDS Aurora but I am very impressed by Aurora's lack of performance.

UPDATE Cars
SET CurrentDriver_id = (
            SELECT Drivers.Id 
            FROM Drivers 
            WHERE Drivers.Car_id = Cars.Id 
            ORDER BY Drivers.Id DESC 
            LIMIT 1)
WHERE Cars.Id BETWEEN 1 AND 500;

I had to limit to the first 500 records so I can even see results in Aurora.

Even limiting to 500 rows, Aurora takes incredibly 55s while MsSQL for all 70.000 records took less than 1 second. In this scenario, MsSQL performs almost 8.000x faster than Aurora.

The subject of this topic is not the query itself, nor how it could be improved. It is just a simple update running on 70k Cars and 220k Drivers. It should be nothing to a database.

Cars.Id and Drivers.Id are primary keys. No indexes and no foreign keys.

Is this expected?!

Edit: 1. Both RDSs are db.t2.medium 2. MsSQL is a production server with hundreds of users while Aurora is only me.

Upvotes: 2

Views: 991

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133360

You could try using an approach that don't use subselect

  UPDATE Cars
  inner join Drivers on Drivers.Car_id = Cars.Id  and Cars.Id BETWEEN 1 AND 500
    SET Cars.CurrentDriver_id = Drivers.Id 

Upvotes: 5

Related Questions