Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many MySQL rows are too many?

Tags:

mysql

I'm working on a website that utilizes essentially a database with a table of organizations, one row for each organization. Each organization can have an unlimited number of attached keywords. The keywords are represented in a separate table from the organizations where each row is simply the primary key, the keyword, and the primary key of the organization it is attached to. Eventually this table could have many thousands of entries. Will this making pulling records from this table, as well as listing unique keywords in the table, too time consuming?

like image 384
Eric Di Bari Avatar asked Jan 08 '10 18:01

Eric Di Bari


People also ask

What is too many rows in SQL?

400,000 to 1,200,000 rows.

Can MySQL handle 1 billion records?

Can MySQL handle 100 million records? Yeah, it can handle billions of records. If you properly index tables, they fit in memory and your queries are written properly then it shouldn't be an issue.

How many rows should a table have at maximum?

1 byte is used to store the slot number, a single page can have at most 255 slots/rows. The maximum number of rows in a table or fragment is 4,278,189,825. These are all theoretical limits.

Can MySQL store millions of records?

Yes, MySQL can handle 10 billion rows. When you define ids on the largest tables, use a bigint . Of course, whether performance is good or not depends on your queries. For basic inserts, updates, deletes, and selects using an index, performance should be okay -- assuming you have enough memory.


2 Answers

Having a couple of hundred thousands rows is perfectly fine, as long as :

  • they are indexed properly
  • and your queries are done properly (i.e. using the right indexes, for instance)

I'm working on an application that's doing lots of queries on several tables with a couple of hundred thousands records in each, with joins and not "simple" where clause, and that application is working fine -- well, since we've optimized the queries and indexes ^^


A couple of million rows, in those conditions, is OK too, I'd say -- depends on what kind of queries (and how many of those) you'll do ^^


In every case, there's only one way to know for sure :

  • You have to know what kind of queries you'll be doing,
  • You also have to have a large dataset to test,
  • And you have to benchmarking : launch the queries on your dataset, a lot of times, with concurrency, as if in "real conditions" -- and it'll help answer to the questions "will it handle the load ? do I have to optimize ? what are the bottlenecks ?"
like image 124
Pascal MARTIN Avatar answered Oct 02 '22 04:10

Pascal MARTIN


Many thousands of entries is not very many at all. Make sure to index on keywords if you need to retrieve specific ones.

like image 36
danben Avatar answered Oct 02 '22 04:10

danben