Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- Good indexing


graeme_p - 9:03 am on Feb 6, 2012 (gmt 0)


1) By primary index, do you mean primary key?
2) Indices always slow down inserts. Its a matter of balancing faster reads against slower writes. Which does that table get more of?
3) Indexes should usually be created for columns that frequently appear in the WHERE clause of queries on large tables...
4).. except where it does not reduce the number of rows a query has to scan: e.g. its rarely optimal to index a boolean.
5) Indexes on small tables may not speed queries up at all, and could even slow them down. If you have ten rows in a tables (e.g. a list of forum sections) do not add indexes....
6) ...if you have hundreds of thousands of rows in a table, you almost certainly need indices on it.

Lots, lots, lots more, but those are important things that come to mind.

Having posts scattered across multiple tables wounds like bad design (not normalised) anyway. Have a posts table, with foreign keys on the member table, and where the post should appear (a sub-forums table, perhaps?).

I think you should post more details, of what you are trying to do.


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4413895.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com