Disclosed in the present invention are a heterocyclic compound, an application thereof and a pharmaceutical composition comprising the same. Provided by the present invention are a heterocyclic compound represented by formula I or a pharmaceutically acceptable salt thereof. The compound has a novel structure and a good inhibitory activity against autotaxin (ATX).