Look up the techniques used in cultures that did this, e.g. ancient egyptians. They used a whole array of things to slow down decomposition.
As for how long it takes a body to show signs of decomposition - that depends on multiple factors such as the temperature, humidity, etc. If it's cold and dry bodies will take much longer to decompose. If the body's buried, then then pH of the soil also makes a massive difference, along with moisture content etc. Mummificataion techniques involve controlling all these things - plus desert sands like in Egypt make mummification easier because arid conditions slow down decomposition. You can completely halt decomposition if you get all the factors right.
A completely sterile environment would also slow down decomposition as bacteria and detritivores are responsible for the decomposition process. This is why some conditions, (extremes of temperature, dry, extremes of pH etc) slow decomposition - they're not favourable conditions for the bacteria. Formaldehyde has traditionally been used to preserve dead animals, body parts etc because bacteria etc can't live in it. It halts the decomposition process.
Tannins have been used for tanning hides because they prevent decomposition of the hides. Prehistoric methods of tanning hides include smoking the hide and rubbing tannins (usually from tree bark) into the hide. "Tanning" has the same etymological root as "tannin". These are chemicals made by the tree to protect it from being eaten. They inhibit bacteria growth. They also give the hide a tan colour (same etymology again). Tannins would partly preserve a dead body and probably have been used for embalming/mummification in the past. You can extract tannins from bark by soaking it in water. There are probably more sophisticated methods than this but I write prehistoric fiction so focus on methods that can be used with middle or upper palaeolithic technology.
Preserving food isn't that different - keep it dry and cold and prevent bacteria etc from growing in the food and it'll last longer. It's the same concept with dead bodies. It's all biological matter. Stick a dead body in the freezer and you'll slow down decomposition.
If you look up resources on forensic science you may find information as forensic scientists look at various factors in the decomposition process to determine time of death in murder victims.