There should be a lot more output for those explains. You may need to do a fetchall
on that cursor. But even that summary line is interesting. Clearly the planner has come up with vastly different results in the two cases.
Follow up suggestion, too - when you print the output from that, print each element of the tuple on it’s own line. It’s going to be a lot easier to read it that way.