Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8988747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:04:50+00:00 2026-06-15T22:04:50+00:00

I have Sql Server database and my table has 1500000 rows …because of large

  • 0

I have Sql Server database and my table has 1500000 rows …because of large amount of data
execution time of my following procedure is very high

TABLE—–

CREATE TABLE [dbo].[MyTable](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Link] [text] NULL,
[Title] [text] NULL,
[Duration] [text] NULL,
[Image] [text] NULL,
[Embbed] [text] NULL,
[Keywords] [text] NULL,
[Category] [text] NULL,
PRIMARY KEY CLUSTERED 
(
[Id] ASC
)
WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

PROCEDURE——

ALTER PROCEDURE [dbo].[Search]
 @SearchQuery varchar(1000),
 @Id bigint
 As
BEGIN
  Select top 100 * from MyTable
  where Id > @Id and Title like '%'+@SearchQuery+'%'

can any one help me how do I minimise execution time of sql query on table of 1500000 rows?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:04:52+00:00Added an answer on June 15, 2026 at 10:04 pm

    You force a table scan by:

    Title like ‘%’+@SearchQuery+’%’

    Actually no – you force definitely the non-use of an index on Title. As indices go “left to right” the “some point in the middle” query thing just turns off index use.

    if ID leaves a lot to search – there you go, especially when you combine that with inappropriately slow hardware (after all 1.5 million is small data).

    You either get rid of the first “%” in the LIKE statement – so an index can be used – or use full text search, which will already break up the words in the index, but even then you better get rid of the first “%”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited a large SQL Server database that has a certain table that
I have an SQL Server 2008 database with a table that has a column
I have a following scenario in my SQL Server 2005 database. zipcodes table has
I have a database in SQL Server 2008 and one particular table has information
In my SQL Server database schema I have a data table with a date
I have a SQL Server database with an Apartment table (which has columns FloorNum
I have a SQL Server 2008 database. This database has a Table called Book.
I have a table called Field in my SQL Server database. The table has
I have a SQL Server 2008-R2 database that has a table that is storing
I have SQL Server 2008 database with 2 tables: Table A has columns ID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.