Objective Achieving efficient rapid demulsification of water-in-oil emulsion constructed of oil with high viscosity was realized.Methods The g-C3 N4 was prepared from melamine by thermal polymerization method.The composite filter cake was prepared by mixing super-hydrophilic g-C3N4 with diatomite,and the high viscosity water-in-oil emulsion was quickly demulsified by pumping and filtering.Results The filter cake containing 1.5 wt%g-C3N4 with 0.5 cm thickness can realize completely demulsified,which the emulsion with water content less 6 wt%and droplet size larger than 2.32 μm.The demulsification rate of 20 kPa vacuum degree can reach 3.57 L/min,the demulsification efficiency is 97.36%,and the oil recovery rate is above 99.72%.Thickening the filter cake can be used for demulsification of emulsion with higher water content.Such attractive demulsification effect is caused by the simultaneous action of strong affinity of g-C3N4 to water and the crushing effect by micropores of diatomite.Conclusion The g-C3 N4/diatomite composite filter cake can be effectively used for efficient rapid demulsification of water-in-oil emulsion with promising application prospect.