I have a stored procedure where the performance is bad. The Execution plan shows 5 table scans each of cost 12%. The data is being pulled from the table using the following where clause.
where (datestamp>getdate() - 'sep28 1902 12:00 AM')
I already have an index on Datestamp column but still Table scan is happening. There is no restriction on avoiding index is specified in the query.
If the index is place inappropriately there would be index scan but here I have table scan.
Could anyone help me in finding out why this is happening.
View Complete Post
I have the following table variable that i store rows extracted from an
declare @tbl_ans table ( AnsText nvarchar(max), IsCorr bit)
this cannothave an index column.
assume it has 25 rows, i need insert each row to a table that has three columns
That Answers table has following structure:
The script should iterate through the @tbl_ans_table table and insert each to the answers table then i should fetch each
a_idx in each iteration and insert it to another. But the problem is how itereate through
@tbl_ans_table without an index?
I have query that behaves much differently the moment I modify the Where clause
The following query runs fast!!
Can you correct me.
I have one table i have create primary key on that. automatically clustered index also created right.
here what is the purpose of primaykey and clustered index also
in case i have drop the clusted index what happend..
I have one small dought,..
Can you any body correct me.
when ever we create a primary key in a table automatically clustered index is created right
what is the task can do in Primarykey here
and what is the task can do in Clustered index here..
can you please guide me..
Can we create indexed view from the base table which has no index?
This is because i don't want any indexes in my base table but for better query performance i want in view..
Thanks in advance,
i am facing a problem to get a correct row index after i filter the data in table, it always keep the history row index in the table before i filter. i had a search button to filter the data in gridview,
below is my coding:
<asp:Button ID="btn_reissue" runat="server" Text="Reissue" CommandName="reissue" CommandArgument='<%# CType(Container, GridViewRow).RowIndex %>' OnClientClick="return window.confirm('Are you sure you want to reissue this record?');" Width="65px" />
Protected Sub grdview_rowcommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridView1.RowCommand
Dim cmd As SqlCommand
If e.CommandName = "reissue" Then
If Not pUser Is Nothing Then
pDbUserCon = New SqlConnection(pDbESS)
pDbUserTrx = pDbUserCon.BeginTransaction()
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow
The query is using a index scan not seek.... how can I get it to use a seek.
I am using SQL 2005
Can you please take a look at the question at the following link and try to help me?
What is a good real world maximum(so i am not looking for this answer:http://blog.sqlauthority.com/2009/06/29/sql-server-maximum-number-of-index-per-table/) for the number of indexes on a table (table has around 50 columns and at the moment 3 indexes)