Oracle runtime of comparing numbers versus comparing strings using a LIKE operator -


My company's database contains 20 different string formats for their primary product labels. All 20 of them are stored in a separate look-up table

1 wire starting with 'w'

starting with "TIC" There are strings starting with 3 'D' ...

The label type is the 'type' attribute next to the attribute, which stores the number associated with the label corresponding to the prefix is. / P>

I have been tasked with updating one of our modules for better runtime. In one of the questions I have run, one of the 'Tiac' labels in the form of the prefix is ​​one. However, instead of comparing it, that type is equal to number 2, it checks for a type of operation for each label that starts with TAIC.

Now, my question is - Since my goal is to move better, should it be wise to perform a regular equality operation against the type character from such operators? It seems that running a regular expression-ish operation against a string takes a little longer, but will it be enough to make significant changes in the runtime of the system?

In Oracle, both of these actions:

  SELECT * mytable WHERE like PK 'TAIC%'   

and

  SELECT * mytable WHERE type = 2   

Sergate , Which is capable of using an index on appropriate fields.

The numerical index, however, will be more compact and therefore requires less time to cross, therefore the query by quantitative comparison In execution Not may increase.

Comments