Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

Indexed Views and Reporting

$
0
0
Hi,I have a situation where a reporting tool that I use needs to query our OLTP database for real-time reporting. While the tool allows for users to see each and every table and visually join them, retrieve the columns, etc. (think QBE in Access...), it's not ideal for them to do that. Therefore, we've created several views that contain the needed fields from many different tables. As you can imagine, these views can sometimes take a long time to run because of all of the joins, data, etc. In addition, if the user wants a field from ViewA, a field from ViewB, and a field from ViewC, then the query that the reporting tool generates ultimately joins each of these views together, which I know doesn't help the query optimizer choose the best plan.I know that some of you have provided some great input like remove any nested views, tune the queries themselves, and possibly add indexes. What I'm intrigued about is adding indexes on the views since the reports are already written against many of them, and even though some return dozens of fields, they're all necessary to provide to the user. I've attempted to create an index on one of the more CPU-intensive views in our non-production environment and received the following error:Cannot create index. Object '<a table name within the view>' was created with the following SET options off: 'ANSI_NULLS'Since the database is from a vendor whose software we use, and the fact that I'm not sure of what the implications would be, I obviously don't want to start changing settings at the database level just to be able to add the index to the view (and who knows what other of the many restrictions on indexed views I'll run into after this one).Given some of my limitations with the reporting tool and database. Does anyone have any thoughts on how I might be able to approach this? I do plan to re-examine the queries themselves and look for indexes I can create on the underlying tables that would help the queries.What have others who have run into this problem done?Thanks in advance,Mike

Viewing all articles
Browse latest Browse all 6525

Trending Articles