So this was the debate where Joe Biden did horribly at the beginning, was pretty bad in the middle and then was suddenly great at the end.

This was the debate where the 78-year-old guy who had a heart attack last week seemed pretty much like the youngest person on stage.

This was the debate in which Mayor Pete Buttigieg and Sen. Amy Klobuchar went after newly minted front-runner Elizabeth Warren, scored major points and made it clear they have to be taken seriously in this race.

This was the debate where Sen. Warren was finally challenged on her fanciful proposals and had no good answers for the Pete-Amy-Joe axis when it questioned how realistic her policies actually might be.

And this was the debate in which a collapsing Sen. Kamala Harris spent five minutes demanding that Warren agree with her that Twitter should shut down Donald Trump’s feed and thereby made herself a national laughingstock.

Ninety minutes in, it seemed like Biden was determined to prove every argument against him true — that he can’t say anything coherent, commits gaffes every sentence and has no response to the Trump claims that his son Hunter did bad stuff in Ukraine.

He declared himself proud of Hunter’s judgment only hours after Hunter himself said he had shown “bad judgment.” He referred to people “clipping coupons in the stock market” when he meant “supermarket.” He said he had spent “thousands of dollars in the situation room” dealing with foreign policy, and he called Syria “Iraq.”

It was all painful — until he snapped to attention more than two hours in and went at Warren by saying Democrats need to talk straight to the American people and tell them what things are going to cost and how they’re going to work.

Before long, he pointed out to Warren that he had worked to get the consumer protection agency she had created as an Obama administration official the votes it needed to become a reality.

She thanked Barack Obama for helping her. She did not thank Biden. It was a spectacularly graceless moment, especially when Biden then congratulated her on her work creating the agency.

To which she said, surprised, “Thank you.”

This was easily Biden’s best moment ever in any debate. I don’t know if it negated the horrid impact of his opening moments, but he gave it a shot.

Still, the story of the debate was really Pete Buttigieg, who has been hovering at the top of the second tier and shows some strength in Iowa.

The most eloquent extemporaneous speaker in the race, Mayor Pete seems to have settled on running as a realistic moderate to fill the space a Biden collapse would open.

He went at Warren’s pie-in-the-sky economic ideas with focus and passion while still remaining perfectly polite. And so did Klobuchar, who is the most natural semi-moderate in the field and who has realized that her only way forward was to take on Warren — and did so with gusto and seriousness.

And what of Warren? Aside from her unwillingness even to acknowledge Biden, she was exactly the same as she has always been. So if that has helped her rise to this point, perhaps it will help her continue to rise. Or perhaps she has already secured the support of everybody who buys into her argle-bargle and has hit a ceiling.

Then they all talked about someone with whom they disagreed but respected and practically everybody said John McCain, who is conveniently dead.