Re: Create indexed view
From: Dejan Markic (dejan_at_akton.is)
Date: 03/19/04
- Next message: Stefan Delmarco [MSFT]: "Re: Mysterious Port of SQL Server not shown by netstat"
- Previous message: David Portas: "Re: Latest data for many objects"
- In reply to: Adam Machanic: "Re: Create indexed view"
- Next in thread: Tom Moreau: "Re: Create indexed view"
- Reply: Tom Moreau: "Re: Create indexed view"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 19 Mar 2004 10:19:33 +0100
Hello!
I've read all that ... I'm just interested about the query with which I can
create an indexed view ... A query that would do the same as UNION ALL, but
would allow me to create an indexed view.
Right now I have a quiry that looks like this:
select id,name from t1 union all
select id,name from t2
Now, I cannot create indexed view because this query uses UNION ... is there
another way to get records from many tables?
Kind regards,
Dejan
[Change TLD from .is to .si]
"Adam Machanic" <amachanic@air-worldwide.nospamallowed.com> wrote in message
news:O8pHbePDEHA.2600@TK2MSFTNGP09.phx.gbl...
| Look up the BOL article titled "Creating an Indexed View". There are a
lot
| of things you need to do in order to qualify for indexed view creation,
| including schema binding, not using SELECT *, including a COUNT_BIG() in
| your SELECT list, etc... They're all listed there. Keep in mind that
| indexed views were created for automatic enhancement of aggregate queries
| that had already been written against base tables (the query optimizer
knows
| to look for indexed views if they're available and use them instead of the
| base tables for aggregate queries... That's what the COUNT_BIG() is for).
| You'll also have other issues in order to make the query optimizer
properly
| use your view because it's partitioned. Another BOL article you should
| check out is "Using Partitioned Views".
|
|
| "Dejan Markic" <dejan@akton.is> wrote in message
| news:2Tg6c.6536$%x4.865008@news.siol.net...
| > Hello!
| >
| > I have three or more tables, each table holds data for one month. Now I
| want
| > to create a view where I would be able to select data from different
| months.
| > I tried to make a view like this:
| > select * from t1 UNION ALL
| > select * from t2 UNION ALL
| > select * from t3 ...
| >
| > ...
| > And it would work OK, but according to documentation this is not an
| indexed
| > view and I cannot create indexes on it. Can I create that view in some
| other
| > way to get the same data and that this view would qualify as index view?
| >
| > Or other way ... if I use indexes on participating tables ... would that
| > help? I hear view would hurt the performace if it is not indexed view?
| >
| > Thanks for you input!
| >
| > Kind regards,
| > Dejan
| >
| >
|
|
- Next message: Stefan Delmarco [MSFT]: "Re: Mysterious Port of SQL Server not shown by netstat"
- Previous message: David Portas: "Re: Latest data for many objects"
- In reply to: Adam Machanic: "Re: Create indexed view"
- Next in thread: Tom Moreau: "Re: Create indexed view"
- Reply: Tom Moreau: "Re: Create indexed view"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|