sql - Is it a good idea to index every column if the users can filter by any column. -
in application users can create custom tables 3 column types. text, numeric , date can have 20 columns. create sql table based on schema using nvarchar(430) text, decimal(38,6) numeric , datetime. along identity id column. there potential many of these tables created different users , data might updated users uploading new csv files. best performance during upload of user data truncate table rid of existing data batches of bulk insert. the user can make selection based on filter build can include number of columns. issue tables lot of rows have poor performance during selection. combat thought adding indexes don't know columns included in condition have index every column. for example on local sql server 1 table on million rows , condition on 6 of columns take around 8 seconds first time runs under 1 second subsequent runs. indexes on every column run in under 1 second first time query ran. performance issue amplified when test on sql azure database same query take on min...