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 8738445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:43:59+00:00 2026-06-13T10:43:59+00:00

I have the very table in sql server 2008 with lot of data |ID|Name|Column_1|Column_2|

  • 0

I have the very table in sql server 2008 with lot of data

|ID|Name|Column_1|Column_2|
|..|....|........|........|

more than 18,000 records. So i need to the the row with the lowest value of Column_1 that is date but could by any data type (that is unsorted) so I use these sentence

SELECT TOP 1 ID, Name from table ORDER BY Column_1 ASC

But this is very very slow. And i think that i don’t need to to sort the whole table. My question es how to get the same date with out using TOP 1 and ORDER BY

  • 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-13T10:44:00+00:00Added an answer on June 13, 2026 at 10:44 am

    I cannot see why 18,000 rows of information would cause too much of a slow down, but that is obviously without seeing what the data is you are storing.

    If you are regularly going to be using the Column_1 field, then I would suggest you place a non-clustered index on it… that will speed up your query.

    You can do it by “designing” your table via Sql Server Management Studio, or directly via TSQL…

    CREATE INDEX IX_myTable_Column_1 ON myTable (Column_1 ASC)
    

    More information on MSDN about creating indexes here


    Update thanks to comments by @GarethD who helped me with this, as I wasn’t actually aware of it.

    As an extra part of the above TSQL statement, it will increase the speed of your queries if you include the names of the other columns that will be used within the index….

    CREATE INDEX IX_myTable_Column_1 ON myTable (Column_1 ASC) INCLUDE (ID, Name)
    

    As GarethD points out, using this SQLFiddle as proof, the execution plan is much quicker as it avoids a “RID” (or Row Identifier) lookup.

    More information on MSDN about creating indexes with include columns here

    Thank you @GarethD

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

Sidebar

Related Questions

I also have a very large table in SQL Server (2008 R2 Developer Edition)
To keep things very simple, say I have a SQL Server 2008 table with
Edit: Im running SQL Server 2008 I have about 400,000 rows in my table.
I have a very large table in SQL Server 2008. It has lots of
Very new SQL Server, am using SQL server 2008. I have two tables, Table
I'm very very new to sql server. I want to have a table with
I have a SQL Server 2008 database with a table that contains a FILESTREAM
I have a SQL Server 2008 database. This database has a Table called Book.
I have a big table in SQL Server 2008 R2. It contains billions of
My DB is SQL SERVER 2008 I have a large table with 100 million

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.