How many rows in a database are TOO MANY?

Juanjo Conti picture Juanjo Conti · Dec 18, 2009 · Viewed 76.8k times · Source

I've a MySQL InnoDB table with 1,000,000 records. Is this too much? Or databases can handle this and more? I ask because I noticed that some queries (for example, getting the last row from a table) are slower (seconds) in the table with 1 millon rows than in one with 100.

Answer

OMG Ponies picture OMG Ponies · Dec 18, 2009

I've a MySQL InnoDB table with 1000000 registers. Is this too much?

No, 1,000,000 rows (AKA records) is not too much for a database.

I ask because I noticed that some queries (for example, getting the last register of a table) are slower (seconds) in the table with 1 million registers than in one with 100.

There's a lot to account for in that statement. The usual suspects are:

  1. Poorly written query
  2. Not using a primary key, assuming one even exists on the table
  3. Poorly designed data model (table structure)
  4. Lack of indexes