I have a simple Indexed View. When I query against it, it\'s pretty slow. First I show you the schema\'s and indexes. Then the simple queries. Finally a query plan screnie.
For some data access layers, such as EF Core it's difficult to add NOEXPAND - so instead you can create an additional view (not schema bound) and add it there. You can call it what you want, but I like to explicitly put NOEXPAND in the name as a reminder.
CREATE VIEW [dbo].[DailySummary_NOEXPAND]
AS
SELECT Col1, Col2, Col3 FROM [dbo].[DailySummary] WITH (NOEXPAND)
END
Also tested on Azure SQL (standard tier)
Important: You can use SELECT *
but if the underlying view changes then the column indexes can get out of sync and you can actually get wrong data back. Much safer to specify columns by name.