Explain indexed views and partitioned view with their syntax.



Explain indexed views and partitioned view with their syntax...

Answer / Sadanand Patel

An Indexed View is a view that has an associated index, which makes it possible to query the view like a table. This improves performance when querying the view multiple times. Syntax:n```sqlnCREATE INDEX idx_ViewName ON ViewName (Column1, Column2, ...);n```nPartitioned views are used to improve query performance on large tables by dividing them into smaller, more manageable pieces called partitions. This allows parallel processing and reduces lock contention.nSyntax:n```sqlnCREATE PARTITION FUNCTION pf_OrderIDRange(int) AS RANGE RIGHT FOR VALUES (10000, 20000, ...);nCREATE PARTITION SCHEME ps_OrderIDScheme AS PARTITION pf_OrderIDRange ALL TO ([PRIMARY], Partition1, Partition2, ...);nCREATE VIEW OrderView AS SELECT * FROM Orders PARTITION BY RANGE FOR VALUES (pf_OrderIDRange) PARTITION SCHEME ps_OrderIDScheme;```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

Can we drop user if user mapped to any logins

1 Answers  


What stored by the tempdb ? : sql server database administration

1 Answers  


What do I need to start working with sql studio? : sql server management studio

1 Answers  


What is transcation?Plz give One example?

2 Answers  


What is single-user mode?

1 Answers  


How do you delete duplicate records in sql server?

1 Answers  


How many index keys possible for a table

6 Answers  


Can we take the full database backup in log shipping?

1 Answers  


What methods do you follow to protect from sql injection attack?

1 Answers  


Is natural join and equi join same?

1 Answers  


What is difference between oltp and olap?

1 Answers  


What is factless fact table? : sql server analysis services, ssas

1 Answers  


Categories