Creating Indexes can be the best thing you do for your SQL Server or any database server.
The indexes help your Server to find the data that the Query is hunting for.
Making your Setup fast and less resource-intensive.
To create an [Index] for the ID Column that is in another Table. (The Main Table ID is already indexed, so you do not have to create it, as it's already there.)
Here, we will create an Index for MainID from [MainTable] to [SecondTable]. These are called [JOIN]'s and are used to create [Relational Table] structures for connected data.
I name them with the TableName_ColumnID.
This helps find the Index within each table's list of indexes. I do the same naming for [Stored Procedures] as well.
[SQL Server - CREATE INDEX]
CFFCS | CarrzSynEdit: | SQL Script
CREATE INDEX IX_SecondTable_MainID
ON SecondTable. (MainID);

This next script creates an Index that includes the items to display on your page.
Open a [New Query] for the Database.
Copy the following and paste it into the New Query.
[SQL Server - CREATE INDEX inclduding Items to output]
CFFCS | CarrzSynEdit: | SQL Script
-- Run this for ArtistID

CREATE NONCLUSTERED INDEX IX_SecondTable_MainID ON MyImages (MainID) 
INCLUDE (ImagePath, ImageWH, Sizes);



However, when you do create an Index, and you find you have more items that need to be added, you have to [Drop] the current Index before you can add more to it.

[SQL Server - Drop INDEX / CREATE INDEX]
CFFCS | CarrzSynEdit: | SQL Script
IF EXISTS (SELECT * FROM sys.indexes WHERE name = 'IX_SecondTable_MainID ')

    DROP INDEX IX_SecondTable_MainID ON ImageTable;
GO
CREATE NONCLUSTERED INDEX IX_SecondTable_MainID ON ImageTable (MainID) 
INCLUDE (ImagePath, ImageWH, Sizes, Desc);