I have several tables that have IsActive column, which indicates whether a record is active or deleted. These tables are used fairly frequently.
Is it common to create a view for each of these tables and select only the records where IsActive is true? Or is this overkill?
A view is just a stored query– it will execute precisely the same way whether you check for isActive in the view or in the
whereclause.If you find yourself using the isActive rows much more often, have a look at filtered indexes. For example, we have a ticketing system where 99% of the activity is related to open tickets. We were able to improve performance greatly by adding filtered indexes for the active tickets only.