I wouldn't worry about replacing the sensor too much. From everything that I have read on the forums and elsewhere it is not a major code and typically the error is not due to the sensor but something else. Possible culprits are timing, o2 sensors, spark plugs/distributor.... Did you get the knock code along with another code, or was it just there on it's own?
1998 Nissan Pathfinder, Chillkoot SE Edition 270,000kms.
Nokian Hakkapelitta LT 31x10.5R15 tires on American Racing BAJA 15x8 rims (Winter).
Goodyear Wrangler Silent Armor 265/65/17 tires on Mamba M3 17x8 rims