Detonation is the fuel in the combustion chamber does not burn but explodes instead. This is bad becused it creates a shock wave going the opposite direction of the normal burn. When the two meet, there is impact, this impact is what you hear in the pinging.
Fuel should burn smoothly starting at the spark plug and speading out evenly.
If you use a fuel with too low octane, on compression, the fuel starts to burn then the pressures execed the fuels resistance to exploding and it explodes instead of burning.
As octane increases, the reistance to exploding increases (good for high compression engines)
Preignition is different, its caused by hot spots (carbon, wrong heat range plugs) and its when fuel is ignited at the wrong time by these hot spots. Poor quality fuel and additives can cause these hot spots.
Both are distructive to engines, causing cylinder overheats and thus causing hot spots and even greater cylinder over temps.
The knock sensor detects DETONATION, not preignition. It tells the computer to retard the timming untill knocking is gone (thus less power)
Youy should use an octane of fuel that does not knock, but going to a greater octane than that is a waste of money.
the 3.5L engine has a very high compression ratio ~10:1 so using anything less than 89 octane will cause detionation and timing retard.
Hope this helps, using good gas, right plugs and keeping the ignition system in good working order are the best things to combat Detonation and preignition