Dear All,
In "VenInvoiceTrans" table ItemIdIdx index is there.
ItemIdIdx combined Itemid and Invoicedate.
If i use index "ItemIdIdx" with select statement then it's search the records win Table "VendInvoiceTrans" with combination (ItemId + InvoiceDate) from database ?
Is't correct?
Because i noticed after use indexing fetching records from table much faster then before.
My question is how indexing perform in database level ?
Please give me more shed on this.
Thanks!
Arpan
*This post is locked for comments
Thanks Sukrut and Vilmos
Indexes work like multi-level sorting in Excel tables. It keeps tracking of record positions within the data file in the order of the first column, then second column, then third, etc.
Ideally you would want an index for a select statement's where clause criteria or order/group by fields where the first column is a match on one of the covering indexes for fastest return time to find the position of the record within the SQL databases' data files.
Clustered index is the main index on how the record is sorted on the disk, so you would want to use fields in the cluster index that are most frequently used for searching in that table.
If you want to know more about it, there are excellent books available, try a Safari books online subscription, there are dozens of SQL books available there.
This probably isn't the proper forum for your question, since it's basically a question about SQL Server.
Indexes are always considered by SQL Server when fetching data. Generally SQL Server, if properly setup and maintained, will choose the "best" plan for fetching and returning data to any query. You can create indexes to give SQL Server more options, and certainly fields and combinations of fields that are commonly used should probably appear in an index (considering the trade-off between write and read performance when creating new indexes). You should not have to specify an index when you write a query. If doing so improves performance, then you might need to review your query, update statistics, or some other maintenance so that SQL Server will compile better plans.
You will find plenty of information online about SQL Server, indexing, and performance tuning. Yes, indexing is important to SQL Server performance, but it comes at a cost and a trade-off of performance.
Mohamed Amine Mahmoudi
100
Super User 2025 Season 1
Community Member
48
Zain Mehmood
6
Moderator