Click here to Skip to main content
15,889,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a SQL database table in which records keep growing every sec when I perform a select statement on the table it takes ~1.5 minutes to retrieve the data with around 380000 records in the table. There are no indexes on the table, I know this is one of the reasons why the data retrieval is slow.
Considering the table grows every sec, what kind of indexes should I apply on the columns and non of the columns on the table are unique and so there is no PRIMARY KEYS.

I have 5 columns that I use in the where condition to retrieve the desired result from the select.

What I have tried:

Need some input before I try something out.
Posted
Updated 8-Mar-20 5:05am
v2

1 solution

You can use the "Execution plan" feature to test if different options make a difference:
SQL Server Query Execution Plans in SQL Server Management Studio[^]

Also see: free-tools-for-sql-server[^]

Primary keys are really a must, if there is no suitable column you can make one using IDENTITY, see info here: Create Primary Keys - SQL Server | Microsoft Docs[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900