MySQL Forums
Forum List  »  Newbie

Re: Are tables independent?
Posted by: Rick James
Date: February 26, 2012 04:39PM

> For example, imagine SELECT from a table with one row. Is this query different (its speed, resource usage, etc)

Each table is effectively independent of all other tables. You can even see the tables in the file system. (InnoDB without file_per_table puts all tables in a single tablespace, but still the "blocks" for each table are independent.)

SELECTing one using an appropriate INDEX will be nearly as fast whether the table has one row or one billion rows. Most indexes are BTrees; a tiny table will have 1 level of BTree; a billion row table will have about 5 levels. Hence, it is not completely as fast.

A single SELECT can JOIN or UNION multiple tables.

Almost always a table should have index(es).

Bottom line: design your tables/databases/etc in a way that makes sense for your application. If you hit any limits (unlikely) or have performance problems, we can discuss remedies.

Options: ReplyQuote


Subject
Written By
Posted
February 24, 2012 12:13PM
February 24, 2012 06:08AM
February 24, 2012 03:49PM
February 24, 2012 04:31PM
February 25, 2012 12:28AM
February 25, 2012 04:58AM
Re: Are tables independent?
February 26, 2012 04:39PM
February 26, 2012 08:00PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.