Tagged Questions
3
votes
1answer
190 views
How much of a view is persisted when you create an index?
Say I have a view defined by the following SQL:
SELECT t1.id, t2.name, t3.address
FROM Table1 as t1
INNER JOIN Table2 t2
ON t1.id = t2.tID
INNER JOIN Table3 t3
ON t1.id = t3.tID
From what I ...
-3
votes
1answer
234 views
Why does a VIEW with a CLUSTERED index not use the index?
I have a view that has a clustered index along with other non-clustered indexes.
A simple SELECT query does not use any of the indexes even when I select an indexed column.
What could be the ...
5
votes
2answers
465 views
Create index view with self join
I use SQL Server 2008 R2 and know that in Indexed View cant have self join.
I have a tree table that have ID and ParentID Column and I need create indexed view on this table with self join between ...
19
votes
7answers
4k views
Writing a simple bank schema: How should I keep my balances in sync with their transaction history?
I am writing the schema for a simple bank database. Here are the basic specifications:
The database will store transactions against a user and currency.
Every user has one balance per currency, so ...
5
votes
2answers
641 views
Using totals on aggregates to improve performance
I have two tables: details and totals of these details.
Details (Slow solution):
select
OrderId = r.OrderId
, TotalQty = SUM(r.Quantity)
, ...