The ideal length is however long it takes to satisfyingly conclude a conflict. That could be as little as one session or as many as fit in several years.
You may benefit from deliberately structuring your campaign so that it includes important dramatic turning points that your players’ brains will experience the same way they experience stories. (That’s not to say you have to pre-plot the campaign and put them on a railroad).
Plan for your campaign arc to include:
1.) Introductory Exposition (a single encounter or session that lays out the greater theme of the campaign - like defeating an evil cultist would be on theme for a climax of defeating the demon that cultist worships).
2.) Call to Action wherein the players are confronted with the central conflict of the game (for example, they find the cultists’ correspondence that lists all the components they need to summon their demon so the players learn what they’re trying to stop and how long they have before it happens).
3.) Fulfill the Promise of the Premise (whatever the theme is here, we need to spend about half the play time living up to it. If the campaign is stopping cultists, we’re gonna have a few encounters or adventures where we do just that. If the campaign is about pirates looting treasures, we’re going to do some piracy).
4.) Crisis Point (where everything goes wrong. The demon gets summoned or the cultists get all their stuff in order to perform the summoning, or having been thwarted they go for revenge on the players’ allies, friends, and loved ones - in which case, get personal).
5.) Climax wherein players resolve the central conflict of the campaign. (I didn’t say ‘win’). They fight the cultists and/or the demon. Or whatever this campaign was about.
6.) A Closing. Star Wars medal ceremony. The smallest close is “and they lived happily ever after.” Or you can do the LOTR “here are 5 more chapters of ending, we’re having a party, going home, fighting in the shire, writing a book, having kids, sailing to the west, more sailing to the west, and so on.”
You could do this in as little as 5 encounters spanning one long-ish play session, 5 adventures spanning 5-6 sessions of play, 6 play sessions into which you reserve session 6 for the Climax and Close no matter what, or whatever.
I favor 6 sessions for a small campaign. That’s A goal. THE goal is the complete structure. If it’s completed, it will feel like a story and that should feel satisfying. My first session is the Introductory Exposition and it ends with a Call to Action. Sessions 2, 3, and 4 fulfill the Premise. Session 5 looks like it’s going to be like 2, 3, and 4 but it ends in Crisis. Session 6 is the final showdown and the medal ceremony (or funeral!).
for bonus satisfaction, adhere to this same structure within each adventure/session of play. Block it out in six 30-45 min increments and keep moving forward rather than staying put in the block you’re in.