Report post #9 in Everything slow after pg_upgrade from 16 to 17
There's your extra second. It has decided the query's expensive enough to compile. Was jit off in your old config, or was it a different package build? Try SET jit = off in the session and run it again.