| Author |
one or many tables
|
|
| geder s dorf 2005-06-16, 8:23 pm |
| What is a better method: creating one large table with a category field or several smaller table
distinguished by the category?
The tables have identical structures. The records are retrieved only form one category at the
time.
geder
| |
|
| geder s dorf wrote:
> What is a better method: creating one large table with a category field or several smaller table
> distinguished by the category?
> The tables have identical structures. The records are retrieved only form one category at the
> time.
One large table.
| |
| Bill Karwin 2005-06-16, 8:23 pm |
| Aggro wrote:
> geder s dorf wrote:
>
> One large table.
Agreed; one large table with an index on `category` is better for almost
all purposes.
I would recommend creating an index for the category field. That would
increase the chances that there is no significant performance cost for
using one table over multiple tables (depending on whether the queries
on category can make use of the index).
Geder does not specify what "better" means for his case -- that is, what
are his criteria. Usually I assume it's for performance of queries.
I can think of one case where you'd find a performance gain by storing
data in separate tables per category: dropping a table is usually
quicker than deleting a subset of rows from a large table. So if
deleting all records of a given category is the most important operation
to optimize, then creating multiple tables may be better.
Regards,
Bill K.
|
|
|
|