I'm reading up on indexes for optimizing database performance and would like to gather best practices for various database situations in terms of applying indexes.
Take a totally non-indexed database with non-trivial amount of tables and rows, what rules do you use in determining what index is applied to what column of what type to achieve maximal performance? What query analyzing tricks to do use?
As a start I got: (from http://asptutorials.net/SQL-Server/tutorial-on-indexes/)
For main or "header" tables such as a table of invoices, make a clustered index on the Primary Key of the table.
For secondary or "details" tables such as "invoice_row", make a clustered index on the foreign key that groups the child records together (which in this example is "invoice_id"). This is because the majority of queries on the invoice_row table will be made in the invoice_id order rather than the invoice_row_id order.
For all tables, make a non-clustered index on each of the foreign keys of the table. Don't concern yourself with covering indexes at this point. Think about the selects queries that you will be performing on the table. What sort of "where" and "order by" statements will you be using? Make a non-clustered index on these columns.
It is now time to start timing your typical queries and look for any slow ones. If you identify a particularly slow one, see if there is a way that you can add extra non-key columns to an index so that it becomes a covering index for that query.
What other "rule-of-thumbs" can we collect? What tools to use?