Health data mining can bring valuable information for drug safety activities. We developed a visual analytics tool to find specific clinical event sequences within the data contained in a clinical data warehouse. To this aim, we adapted the Smith-Waterman DNA sequence alignment algorithm to retrieve clinical event sequences with a temporal pattern from the electronic health records included in a clinical data warehouse. A web interface facilitates interactive query specification and result visualization. We describe the adaptation of the Smith-Waterman algorithm, and the implemented user interface. The evaluation with pharmacovigilance use cases involved the detection of inadequate treatment decisions in patient sequences. The precision and recall results (F-measure = 0.87) suggest that our adaptation of the Smith-Waterman-based algorithm is well-suited for this type of pharmacovigilance activities. The user interface allowed the rapid identification of cases of inadequate treatment