I believe we are getting better at it. It's a lot different from when I started 25 years ago. Working the front line with no supporting system, interacting with the travellers, that was my training. Today, officers interact with people, but the risk assessment is done well in advance.
Also, today a traveller showing up at an airport can use an automated border clearance kiosk instead of interacting with an officer. It is necessary to monitor compliance. Not everybody referred for a secondary examination is suspected of being a drug smuggler. Some people need to make a declaration. We need to document their passage. There are plenty of reasons why somebody would be referred for a secondary examination.