I think a lot of people are kind of looking at this oddly, like:
Food is really good!
+2 food in all my cities is amazing!
So maritime states are amazing! (this is true, btw)
...so granaries are bad!
The last step is the logical disconnect. Granaries are a good building. They are much less efficient than maritime city states. They are probably not worth building in your capital. They are probably not worth building when your cities are at some level of pop and are not going to grow much more relative to when you are planning to end the game (say, not worth building at 6-8 pop if you're planning to end the game with a domination victory at pre t200, or not worth building in a city that has very low base production and naturally high food that really wants a monument). They are also probably not worth building if it's earlygame on a high difficulty level and you need military immediately (note: I usually expand to 4-6~ cities early on deity and can manage a granary in all but my capital usually. Less if there's an early DoW.), but all that aside they're a remarkably solid building.
-
Misc. granary example:
Build a granary early enough that you have had it for 31t before the 63 food step, or 38t before the 76 food step. The granary gives you this step for 100p (200g) and 1gpt. When you hit this step you get +1.5sci +3ppt (+6gpt), except it has maintinence so really +1.5sci +2.5gpt/5gpt. 100t later you're looking at +500g +150sci, assuming you build no other modifiers in those cities. This is a pretty neat boost.
Note: this math is not totally true, because the granary also notches up the food req for next step, so secretly you don't get this full benefit because you're hitting the next step slower. Except you kind of do because the granary contributes to this step too, so it probably doesn't apply till a few steps down the line. But you still get pretty close to this kind of math for a long time and I do not have enough time to work out diminishing returns now.
Note #2: If you get a few trading posts razed or lose a warrior because you did not have enough warriors to deal with barbarians, this stuff all kind of gets canceled out. Maybe you don't want granaries in all your cities vs. having enough early military.
-
Also, misc. math on granaries vs maritime cs:
5~ cities, including capital. early game empire but this is when this stuff matters most. We'll assume you have 1-2 maritime states and your capital has been busy pumping settlers and building a worker or 2, so you don't have one in the capital. In other cities then, you're looking at 400p (roughly 800g value) up front and 4gpt for +2 food. This is significant.
A maritime state is 500g up front, and 1gpt. Assuming you're looking at 35 inf for 250g it's also 7gpt~. HOWEVER, it also comes with a lux resource, which is either not-unique and worth 200-300g/30 turns in trades, or unique and worth 187.5p up front and 4gpt~ (when compared to colosseum required to support pop assuming you need the happiness anyway. And you do if you're playing optimally.). So you get like 6gpt~+ from the lux resource when sold. Or more if you're using it instead of a colosseum if you mix in the up front hammers.
Note that also this is worst case for the maritime state - late game it applies to more cities and is even better. Also it goes up to 3! food later. Also patronage reduces the influence degradation by 0.25 which is really more like +33% influence per gold. Note that even hostile states are > granaries with any of these things mixed in.
Finally: Remember that maritime states being ridiculously amazing does not make granaries bad. It just means maritime states are better and you should understand how awesome they are and devote resources to getting them. Sure, the maritime states kind of overshadow the granary in terms of benefit, but granaries are *still good*. It's not a competition between maritime states and granaries, but getting your cities to grow while still working as many awesome gold/prod tiles as possible.
-
TLDR summary:
Food is great!
Granaries are good! Mostly! (Exceptions: need hammers desperately for military early game. City is not going to benefit much from the +food from the granary relative to when you're looking at ending the game. (e.g., building a granary when you have 10 turns left in the game is dumb. building a granary when you have 50t left in the game but your city is going to take 25t to grow anyway is not worth it.)
Maritime states are ridiculously amazing!
Maritime states being ridiculously amazing does not somehow make granaries bad.
-
Edit: Alternative potentially viable early deity option: Build just monument + library early, skip granaries, work less production and more gold/food squares, and then focus more on production a little later. I'm not sure how you'd go about mathing this out though.