Your original circuit drops the excess voltage across the resistor and about 0.7V across the conducting diode.
Let's say your input is 9V Diode D1 will conduct and the anode will be about 3.3V + 0.7V or 4V. Therefore, R1 drops the difference, 5V. One end of R1 is at 9V and the other end is at 4V so the drop is 5V. How much power it dissipates is determined by the resistance value P = E
2/R
If you use a 1k resistor, you dissipate 25/1000 or 25 mW. If you use a 10k resistor, you dissipate 2.5 mW.
I would use a Schottky diode because, internal to the uC, they are using Schottky diodes for the very same purpose - input pins are clamped (usually). If you use a Silicon diode, the internal diode will turn on first (0.2V?) and it will have to do all the clamping and your external circuit is mostly useless.
1N5817 has a very low forward voltage drop at low current:
https://www.diodes.com/assets/Datasheets/ds23001.pdfIn this case, the voltage at the pin might be just 3.3V + 0.15V or 3.45V. Much better. But you need to keep the current low so you need to so some math to figure out how much resistance you can handle. You get that from the input characteristics of the uC pin. How much current do you have to source at what voltage? Those numbers come from the uC datasheet. You need to consider how much voltage drop over R1 is added because of the input current. It won't be much but it is not zero. You also need to ensure you get over the input threshold voltage.