Let's ponder the ubiquitous lithium-ion battery.
Per Wikipedia the volumetric energy density is 900 to 1900 joules per cubic centimeter. If you've ever opened up a laptop battery, you know that it's usually just a collection of normal-battery-shaped cells within a plastic container designed to match the lines of the laptop it will be used in. Indeed, the cells themselves are often mistaken to be the size of an AA battery, which per Energizer's lithium AA battery datasheet is 8.0 cm^3.
In reality the cells are a bit larger, usually. AA batteries are roughly 50mm in length and about 15mm in diameter, whereas the high-capacity Li-ion battery cells commonly found in laptop batteries are actually around 65mm long and 18mm in diameter. Indeed, battery nomenclature would refer to the latter as an 18650 type, and you can get AA-size Li-ion batteries (in the native 3.6v) called 14500 . . . obviously they just call them by the "DDLL0" scheme, where D is diameter and L is length. But let's digress . . .
We could do a cylinder volume calculation to try to get the volume of an 18650, but I don't know the wall thickness and some other potential complications, so we'll just roll with AA.
So let's ponder an eight-cell Li-ion laptop battery (pretty standard, though six-cell units also exist for netbooks and such) and assume AA size cells of the energy density provided. Since we're thinking of cells a bit smaller than commonly used this may be a tad conservative, but that's okay for this purpose.
That's 64 cubic centimeters of volume, which at full ideal charge of 1900 joules will provide 121600 joules.
121 kilojoules is a good bit of energy. That's the equivalent of two minutes of sunlight on a square meter of Earth's surface. In kinetic terms, it is approximately the kinetic energy of the Tesla Model S , which is powered by thousands of 18650 batteries, doing about 26 miles per hour, sufficient to outpace most anyone except Usain Bolt at burst speed.
KE = .5 (1800) (11.6^2)
KE = 121104 J
That's about the same as an early 90's Ford Crown Victoria (at 1700kg curb weight) doing about 26.8 mph (later Crown Vics weigh about the same as the Tesla Model S). Either way, that's enough to do a good bit of damage if you stood in front of it. (Your risk of death by being hit by a car doing twenty miles per hour is a mere five percent, but at thirty miles per hour it's closer to forty percent, implying there's some threshold that a Crown Vic doing twenty-seven would likely cross.) For the sunlight example, that energy is more than enough to ruin your sunbathing. And all that energy is contained in a wee little laptop battery pack that you think little of (unless it's low on juice, in which case you think unprintable things).
Now, we can compare against some other things. For instance, the energy density of modern/military dynamite is about 7.5 megajoules per kilogram, with old dynamite around 5 MJ/kg for purely nitroglycerin-based dynamite. That's pretty close to the figure of TNT at 4.7 MJ/kg, or 7500 kJ/kg and 4700kJ/kg, respectively. So, the energy in our Li-ion laptop battery back would be in the range of 16 to 25 grams (not kilograms, just grams) of explosive.
By volume, a classic cylindrical stick of dynamite, at about 20cm long and 3.2cm wide and weighing in at 0.186kg, has an energy of about 1.4 megajoules using newer formulations, or about one megajoule for older dynamite. The stick's volume is 160.85 cubic centimeters, so taking megajoules per m^3 we find dynamite to be in the range of 6200 to 8700 megajoules per cubic meter, or 6200 to 8700 joules per cubic centimeter . . . several times the volumetric energy density for a Li-ion battery per Wikipedia.
(A laptop battery pack made of old dynamite or TNT would give you aplenty of energy to run your laptop but I, for one, have no intention of rushing out to buy such a battery pack. I think you'll find they discharge a bit too quickly and recharging is a real hassle!)
The volume of our 16 to 25 grams of explosive would be equivalent to 1/7th to 1/10th of a stick of dynamite. There aren't exactly a lot of Youtube videos covering such odd measurements of explosives. However, people often try to simulate dynamite with flash powder as often found in fireworks, a much slower explosive.
As has been popularized, we know laptop batteries can explode, as seen in this "controlled demonstration". But are they exploding like a tenth of a stick of dynamite? No, they are not. Here's a video reportedly showing a 10 gram flash powder device, all taped up for pipe bomb effect. Here's a 20 gram one. But, with the variability of flash powder and the devices, your joulage may vary.
And are the batteries actually exploding because of the release of their charge? Not exactly, no . . . the main issue is that the battery material itself is flammable and pressurized, and overheating due to a short can cause overpressurization and potential ignition of the battery's electrolyte.
That distinction is important . . . that's energy separate from the actual charge of the battery. If Li-ion batteries weren't basically flammable little pipe bombs, then there would be no comparison to make at all.
Pondering the Tesla, yes, it's got thousands of little flammable pipe bombs in it. But is that really any worse than a tank full of gasoline? Not really, no.
If the batteries go up, it isn't like she's releasing all her energy. With her big battery rated for 85 kWh (306 megajoules, give or take), there's a lot of energy available . . . about twice what is needed to vaporize a human being based on water content, or the equivalent of 65kg (140lbs) of TNT or, by the megajoules, 40.8kg (89.9lbs) of dynamite. Just for reference, here's 100lbs of dynamite against a house. Compare that to the comparatively unexciting fire of a Tesla Model S after a collision with a metal object penetrated and damaged one of the 16 battery modules. As Tesla put it in their press release, "the combustion energy of our battery pack is only about 10% of the energy contained in a gasoline tank".
So yes, Li-ion batteries are flammable, but not as energetically so as gasoline.
So what if you had a battery capable of holding a charge like that but which wasn't flammable? Could you make the battery explode? Maybe, if you tried hard enough, though I think your time would be better spent trying to get that puppy to market. But even if you did, does that mean it would be releasing its charge? Probably not.
Hmm . . . so with this in mind, let's ponder a phaser on overload.
I've recently seen someone try to argue that in various phaser overload events "the phaser overloaded and exploded, releasing all its energy", which "conclusively demonstrate lower total energy capacity" for phasers, which thus "appear to place the firepower in the low megajoule range".
Based on our ponderings thus far this seems unlikely. By a similar rationale, this would be like calculating the yield of the Tesla fire and then deducing their acceleration from it. Sorry, but that plan's no good.
True, there are the stated draws for a phaser rifle on unknown setting of a megajoule per second (with the fire in "The Mind's Eye" continuing for something like 16 seconds, suggesting the equivalent of a few kilograms of TNT (though perhaps not 15)). Of course, as noted, that's a phaser at unknown setting being fired against some sort of phaser diagnostics target, so one would think the setting somewhere far south of maximum.
Then there's the phase pistol event from "Regeneration"[ENT] where Malcolm Reed doubles the particle yield. But, to do so, he has to "increase power another five megajoules. Fire. Keep it going. Increase to seven megajoules. Try eight. Nine. The density's holding. Bring it up to ten." Ironically, this weapon is also fired for 16 seconds. The phrasing is a bit unclear ("another five megajoules" implies a prior raise of five megajoules or at least some figure in the megajoules, but then he pegs it to seven, suggesting a starting point around one, not to mention the whole power-in-joules thing), but it seems that we get multiple megajoules of energy expended in those seconds.
And, of course, there's Scotty draining phaser power packs, converting them into a pressurized fuel of some kind sufficient to provide enough energy to a shuttlecraft to achieve orbit, whatever that energy might be. The process consumes much time and apparently has to despite the rush due to giant alien cavemen attacking the shuttle and its people . . . as Scotty notes, a phaser "can only drain so fast".
We don't know the required battery power of a phaser set to kill, but Captain Tracey did kill several hundred Yang with his phaser and multiple power packs in "The Omega Glory"[TOS3]. The kill settings are higher up the scale of phaser settings, suggesting a significant battery event. 150 to 200 kills per power pack wouldn't be anything to sneeze at, even in less efficient uses like widebeam or just via sweeping the weapon while firing.
Note that none of these examples are about the effective yield of a phaser, i.e. its effect on targets when fired. Vaporizing people and rocks can require hundreds of megajoules or more of effective yield. We are distinguishing here between the actual energy of the weapon's power cells and its effective yield.
This is a distinction not made by the person claiming an overloading phaser is releasing all its energy and thus providing a constraint on its firepower.
So, the argument is basically akin to saying that if you overload your laptop (or even better, a laser pointer) you can make the batteries release all their energy in an explosion. Or for an alternate example, that you can take that Tesla and overload it, causing the battery packs to detonate with a house-splintering effect. Or that you can take the Crown Vic and overload it somehow, making the gas tank explode by mechanically vaporizing the fuel to achieve the best air-fuel mix.
Sorry, but no.
Of course, some might argue those are bad analogies, but how would they know? Put simply, we don't know the mechanics of a phaser overload event. We don't even really know the innards of a phaser in the first place, for that matter. We know from "The Mind's Eye"[TNG4] that there's a prefire chamber (with a pulse frequency), an emitter aperture, an energy cell, and a discharge crystal, and that's about it. We don't even know what the battery is made of or anything about how it operates.
Now, assuming commonality, we can presume that the energy cell is (sarium) krellide, as found on shuttles. Geordi, in "In Theory"[TNG4], tells Picard that his "krellide storage cells are losing their charge". Krellide power cells were also used in a years-unused Vulcan transmitter in "The Andorian Incident" from 200 years prior to Geordi's statement, and they still had enough juice to call the ship from the surface. There's also a shot of the "energy signature" of the shuttlepod from "Descent, Pt. I"[TNG6]. It shows two 750 millicochrane impulse driver engines, eight hot gas thrusters, and three sarium krellide power cells.
And yes, sarium krellide is capable of being used as an explosive via some unknown detonator, per "Night Terrors" . . . per Bernd's transcript of the screen, Clancium oxide was a "Medium-yield explosive used for high-volume heat generation in emergency situations. This compound is preferred to conventional sarium krellide explosives because of superior thermal dispersion characteristics in low-pressure atmospheres."
No, that doesn't make a great deal of sense on a first read. The only other medium-yield explosive mentioned is "Todotracium", a "Controllable medium-yield propellant used in small solid rocket motor devices and emergency disconnect explosive bolts." Presumably the difference between a medium-yield propellant used in explosive bolts and a medium-yield explosive used for high-volume heat generation would be that the latter puts out hotter gas which, for whatever reason, disperses better in low-pressure atmospheres compared to sarium krellide, somehow or other.
In any event, that comparative (we don't get an entry for sarium krellide) does not necessarily imply that sarium krellide is volatile. The "Night Terrors" list includes things like "Neussite 283", a "Highly stable liquid explosive used for industrial infusion charge applications and manufacturing. Ignited by microwave pulse detonator." Another substance mentioned is ignited by "standard microwave pulse ignition devices". In other words, you'd probably never have a problem storing Neussite 283 unless you use a microwave pulse detonator or similar special doohickey, and many of the explosives on the list are similarly troublesome to make blow. On the other hand, some are specifically listed as being unstable or volatile.
That all said, one interesting possibility is that it actually makes a bit of sense that sarium krellide would have potential explosive characteristics . . . after all, these people use plasma conduits for their power systems, so it seems as if your batteries would need to be capable of providing plasma. If the stuff carries a charge, to boot, then it's potentially a self-powered plasma power generator. That would also make Scotty draining phasers into fuel make sense, assuming sarium krellide were in use for phasers.
On the other hand, TOS shuttle batteries apparently couldn't be converted in the fashion of the phasers . . . Scotty, while draining phasers, used the batteries of the shuttle to electrify the shuttle's hull, and needed their power for fuel ignition. One would've thought that the batteries of a shuttle would be larger and more powerful than those for a few phasers.
But in any case, the money point here is that while sarium krellide can be made to explode by some unknown means, it also can carry a charge.
And back to the main point, does a phaser on overload detonate the batteries or release the charge, or both? For all we know, a phaser on overload just disconnects some critical bit that makes it actually fire so it overloads the prefire chamber, merely dismantling the battery in the subsequent smallish explosion.
Certainly that seems more consistent with the relatively low yields some phaser overloads have shown.
Put simply, we don't have a firm grasp on what exactly happens when a phaser is overloaded. However, since we have canon statements of batteries with many megajoules available, pointing to a low-yield small-fireworks-grade overload and declaring that to represent maximum phaser firepower is exceptionally weak at best, and just plain disingenuous at worst.