0

I have 3 tables customers, customer_address and customer_org with 20K records and I want to insert a new record with checking 'Email' of new record with table customers 'Email' attribute already exist or not.

To insert 17K records it is taking 1Hr 21Min.

I'm inserting a new record in all 3 tables, if the new record Email does not exist in customers table. So is there any solution to reduce this time?

I'm using Laravel framework.

Database: mysql innodb

Blauharley
  • 3,936
  • 6
  • 25
  • 45
Dev_lover
  • 1
  • 2

2 Answers2

0

Solution: 1> create a cron job for it which automatically takes care of it without user intervention.

2>Use SAS disk or SSD's for MySQL database.

Dev_lover
  • 1
  • 2
-1

It's not clear what your schema is including it's constraints and indexes or what your actual queries / statements are. It's impossible to answer your question without this information, and without any profiling data.

You would do well to read up on MySql Profiling, as this will help you to find out what is going on with your queries / statements.

If I were to hazard a guess, however, I would guess that the 'customers.email' column is not properly indexed.

Tom Drake
  • 517
  • 5
  • 10