In engineering analysis, CAD models are often simplified by removing features, enabling meshing to be quicker and more reliable; the resulting smaller meshes in turn lead to faster analysis. Finding features by hand is tedious, and there is a need to automate this process. A declarative approach to feature recognition allows engineers to define features relevant to a particular problem, without detailing how they are to be found. Here, we show that a declarative feature definition can be turned into an SQL query, and database engine coupled to a CAD modeler can be used to find instances of entities satisfying the predicates which make up features. A key benefit of doing so is that database optimization techniques built into a modern database can effectively execute the SQL query in an acceptable time to find features. We present experiments to show the benefits of various database optimization techniques. We determine how the time taken to find features scales with number of features and model size, using different optimizations. We also give results for real industrial models.