A knock sensor is an electric device that basically makes it possible for the engine control unit or ECU to measure the engine block vibration. If it wears off for some reason, your engine will run poorly and consume more fuel than usual.
https://www.youtube.com/watch?v=3BQu3U0ecos