And worry about it later like when I have few hundred records at least?
views:
28answers:
3Sure, no problem. It is fairly trivial to add your indexes later on. The only recommendation I have is to make sure you have any constraints/unique keys defined during development so that you can test your code when it tries to violate the constraints.
Well, yes - you can definitely add your indices later on.
However: if you develop your app without any indices, and only a handful of test rows in your tables, you might not get a good feeling for how it'll behave under load.
Using the right indices, you can gain a lot of performance boosts - and having no indices, or the wrong ones, can severely and negatively impact your app.
So in my opinion, being able to have the indices in place during development, and paying attention to them, is crucial for your app to get a good understanding of where and how you need to possibly tweak your settings.
Personally I think it is a problem that you don't intend to immediatley fill your development database with test records that will be roughly the size you expect the database to be in. SQL is very sensitive to size and you will almost certainly write bad code if you are not writing it against a database the size you think you will have. That cursor that took ten seconds in your little dev database might take 18 hours on production with a full record-set. That's why it is critical to develop against a full record-set.
You can adjust indexes as you go (you may not know what fields you are going to need in your where clause suntil you start to wrtie the SQL code), but do not fail to create primary key, foreign keys, indexes on the foreign keys and any unique indexes you need to enforce data integrity. This is an important part of database deveopment and should not be pushed off til later for no reason. Also build any constraints you need first. You want to know if your application will fail the constraints during development not after you have 2 million bad records in the database.