Right. For some problems it’ll be optimal in execution time, for most it won’t be and you may be forced to let it approximate. But that’s usually still good enough.
Which is distinct from spending time trying to find an optimal solution, in the general case.