Actually, I was thinking that the SQL using the OR and LIKE and SUBSTR is not going to be very efficient and is going to scan the data.
I am thinking of maintaining another column (via a trigger) to contain the first letter of the band name and if it is not a letter, store # in the field, so the SQL becomes:
SELECT band_name
FROM bands
WHERE band_name_begins = @p
And put an index on this column, as the data is rarely updated or added to, but read A LOT.
I am thinking of maintaining another column (via a trigger) to contain the first letter of the band name and if it is not a letter, store # in the field, so the SQL becomes:
SELECT band_name
FROM bands
WHERE band_name_begins = @p
And put an index on this column, as the data is rarely updated or added to, but read A LOT.
Comment