How other people answered your question to help you better understand, in my opinion, you should first understand why you need to use indexes. Since we know that indexes improve performance, they can also cause performance problems. It is better to know when you need to use indexes, why you need to use indexes instead of using indexes.
You can read almost every little thing from here .
As for your example, your query index is not affected. Because it does not have the column mentioned in your query where clause.
You can also try:
CREATE INDEX yourIndexName ON yourTableName (column_you_are_looking_for1,column_you_are_lookingfor2 )
It is also useful to know: if the index does not exist in the table, a table scan should be performed for each table referenced by the database query. The larger the table, the longer the table scan takes place, because the table scan requires each row of the table to be accessed sequentially. Although a table scan can be more efficient for a complex query that requires most of the rows in the table, for a query that returns only some rows of the table, index scanning can more effectively access the rows of the table. (source here )
Hope this helps.
source share