In this paper, the two-dimensional hole gas (2DHG) induced in the heterojunction were investigated in detail. The density of the 2DHG was calculated at first, then, based on the semiconductor-insulator-semiconductor and superlattice critical thickness model and using the self consistent Poisson-Schrdinger calculations, the influence of the AlGaN barrier and the top GaN layer thickness on the distribution of the 2DHG were calculated when the barrier layer is fully strained and half strained. The Schottky device with this structure was fabricated and C-V measurement was made to verify the existence of the 2DHG and the validity of calculation results. Finally, the 2DHG effects on p-GaN/AlGaN/GaN Schottky photodetector were investigated. Due to the polarization and Stark effect, the spectral responses with the 10nm blue shift are observed. Under zero bias, the peak responsivity of the device is about 0.022A/W, and increases to 0.19A/W under 1V reverse bias, which approaches the theoretical limit.