0

I would like to minimize the performace impact of the following query on a Sybase ASE 12.5 database

SELECT description_field FROM table WHERE description_field LIKE 'HEADER%'
GO

I suspect I cannot do better than a full table scan without modifying the database but does someone have an idea?
Perhaps an improvement relative to locking would be done thanks to a special syntax?

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
freakhill
  • 628
  • 3
  • 6
  • [dba.se] is a better site for asking performance-related questions about SQL. –  Jul 23 '12 at 11:57
  • If you have non clustered index on this column.Then that is best you can get as it will work as non covering index.Also, if you NC index which have this column and index key size is less than table row size then that index should be used and ultimately table scan is last option if you do not have any index at all on the column. – Gulli Meel Jul 23 '12 at 13:29
  • thanks for the valuable feedback! – freakhill Jul 24 '12 at 03:48

1 Answers1

0

In this case you should get a large speedup by adding an index on description_field.

This works because the like string starts with non-wildcard characters. If the string start with a % then there is no alternative to doinf a table scan.

mmmmmm
  • 32,227
  • 27
  • 88
  • 117