Last post Jul 08, 2011 08:35 AM by Horizon_Net
Jul 08, 2011 04:50 AM|nareshyalagala|LINK
I have a database in that I have a view which inner joins four tables.
1. If I create a new table with same structure & data of this view, and I query the table, will that fetch records more faster than fetching records from VIEW ?
2. Another question is I am searching in six columns of view (Data type VARCHAR(size 500) ) to fetch records (I am using like operator '%searchtext%' ). My View has 5000 records. So this query is taking more time. How can I improve the performance of this
query with out removing LIKE operator
Please answer two of my questions
Jul 08, 2011 05:22 AMfirstname.lastname@example.org|LINK
1. Views will improve the performance.
2. Like operator always taking some time, what u can do is in the select query if any unncessary columsn are there then remove that.
and in the same view if you have any rpimary key column wiht int datataype then add a where condtion as that column should > 0
Jul 08, 2011 06:38 AM|eralper|LINK
Select from a View or from a table will not make too much sense.
Of course if the View does not have unnessary joins, fields, etc. You can check the execution plan of your queries, joins and indexes used to improve the View performance
You can even create index on views for faster search requirements.
But if you are searching like '%...%' than the sql engine will not benefit from an index on text column. If you can force your users to make searches like '...%' than that will be fast
Jul 08, 2011 07:08 AM|yrb.yogi|LINK
An indexed view is similar to a table. The data touched by the view's definition have been materialized to disk. This is used mainly for aggregation, so we can avoid scanning the table / index everytime we need to pull aggregated data.
Types of Views
In SQL Server 2008, SQL server has partitioned-aligned indexed views.
Improving Performance with SQL Server 2008 Indexed Views
Jul 08, 2011 07:15 AM|amitpatel.it|LINK
View is faster then select query and table.
Jul 08, 2011 07:41 AM|gurdeep_677|LINK
View is faster then select from table. and
You should change your DataBase design accordingly. In which you should not need to search such data with like operator. You should use Primary Key for searching the data. Like Operator reduce the performance. It is usefull when the searchable data is small
but it is not recommended for large data searching. Instead of Like operator you can also use FreeTextSearch functionality of SQL Server.
Jul 08, 2011 08:35 AM|Horizon_Net|LINK
if the table and the view have the same structure and data in it, a view is slower than a normaler query, because the view has to be generated from the table every time you query it. This is a step which is not necessary in a normal query. This is why a
view has normally only a piece of data from a table. In this case a view is faster than a normal query.