The purpose of the present invention is to provide a glucokinase activator which is useful as a pharmaceutical agent such as agents for the prophylaxis or treatment of diabetes, obesity and the like, and the like.The present invention is a compound represented by the formula (I):wherein each symbol is as defined in the specification, or a salt thereof.