Martin Vajsar wrote:First of all, how often is the query run, how long it takes now and how much do you need it to improve?
If there isn't an index on the EMPID column, create one. Since you're selecting just a few rows, the database should use the index and it should be quite fast.
The query itself is so simple that there isn't much to optimize. However, you should explicitly name columns instead of specifying SELECT *. It won't help much, but (depending on the database, your indexes and network) it might be a bit faster, especially if you select more than just a few rows and/or there is an index containing all columns you're selecting.
No more Blub for me, thank you, Vicar.
Their EMPID is a primary key. The index is not defined properly. First Employee ID is 1000 the n may be next one is 10010. So no proper indexing
Vishal Baid wrote:I am using MYSQL. EMPID is not auto-incremant. In ofbiz framework, the primary key Empid is random number. Not in an order that is why i am facing this issue.
MySQL manual wrote:The primary key for a table represents the column or set of columns that you use in your most vital queries. It has an associated index, for fast query performance.
No more Blub for me, thank you, Vicar.
Don't get me started about those stupid light bulbs. |