A growing mount of available text data are being stored in relational databases, giving rise to an increasing need for the RDBMSs to support effective text retrieval. In this paper, we address the problem of keyword query segmentation, i.e., how to group nearby keywords in a query into segments. This operation can greatly benefit both the quality and the efficiency of the subsequent search operations. Compared with previous work, the proposed approach is based on Conditional Random Fields (CRF), and provides a principled statistical model that can be learned from query logs and easily adapt to user preferences. Extensive experiments on two real datasets confirm the effectiveness the efficiency of the proposed approach. Categories and Subject Descriptors H.3.3 [Information Systems]: Information Storage and Retrieval--Information Search and Retrieval; H.2.4 [Information Systems]: Database Management--Systems General Terms Algorithms, Experimentation