Despite being filled with Oracle veterans, Salesforce.com can’t seem to stop flirting with rival databases, with reports surfacing that the SaaS vendor has made “significant progress” to move away from Oracle with its own homegrown database. This comes on the heels of Salesforce adding to its investment in NoSQL database leader MongoDB, which compounds the company’s long-standing interest in PostgreSQL.

With Silicon Valley at the vanguard of change, Salesforce’s infidelity to Oracle could be a sign of, or at least a spark to, a broader shift in enterprise database decisions.

This looking beyond Oracle shouldn’t be happening

Oracle has dominated the database industry for decades, using that heft to catapult it into enterprise applications and other adjacent markets. Lately, however, the wheels seem to be wobbling on its database gravy train. As Gartner analyst Merv Adrian has made clear, although Oracle still has a commanding lead in database market share, it has bled share every year since 2013. The only thing keeping the wheels on that train is inertia: “When someone has invested in the schema design, physical data placement, network architecture, etc. around a particular tool, that doesn’t get lifted and shifted easily, something that Gartner calls ‘entanglement.’”

Such entanglement has been particularly strong at Salesforce. With nearly two decades invested in Oracle, the pain involved in moving off Oracle would be substantial. Even so, and despite a 2013 megadeal between Salesforce and Oracle to cement Salesforce’s dependence on the database giant for nine years, Salesforce has never really stopped shopping around for alternatives.

The reason? Data sovereignty. Even if Oracle weren’t a fierce Salesforce competitor (and it is), having another vendor—any vendor—own such a critical part of a company’s data infrastructure necessarily reduces its agility.

Shopping around for database freedom

And so Salesforce has been looking for alternatives to Oracle. Although attempts to build its own database are relatively new, Salesforce’s attempts to look at rival databases has been going on for years, most recently with MongoDB. As reported, Salesforce just increased its investment in NoSQL leader MongoDB by nearly 45,000 shares, having first invested while MongoDB was still a private company. Between the two investments, Salesforce’s MongoDB investment represents 6 percent of its institutional holdings, the second-largest such investment it has made.

Salesforce has been an active investor in a variety of startups over the years, using such investments to strategically keep a pulse on the market (while keeping competitors out). With investments as varied as Twilio, Jitterbit, and SessionM, Salesforce has been a very active investor with tens of millions of dollars plowed into dozens of companies.

Seen this way, the MongoDB investment is no big deal.

Indeed, Salesforce’s MongoDB investment is a rounding error in MongoDB’s current $1.9 billion market cap. Even so, the fact that the SaaS vendor opted to put money into an Oracle database rival suggests an interest in keeping a foot firmly planted outside the Oracle camp. Nor is it alone: MongoDB counts more than 6,000 customers, indicating broad interest in moving beyond Oracle for modern applications.

And yet Salesforce’s database wanderlust points to a different database than MongoDB that could spoil Oracle’s dominance.

A long-term flirtation with PostgreSQL

If, in fact, Salesforce is developing a homegrown replacement for Oracle’s database, it might well be building it on PostgreSQL, the database Salesforce has actively flirted with since 2012. In 2013, Salesforce hired Tom Lane, a prominent PostgreSQL developer. In that same year, it hired several more, and even today PostgreSQL experience is called out for in dozens of jobs advertised on the company’s career page. Just as Facebook, Google, and other web giants have shaped MySQL to meet their aggressive demands for scale, so too might Salesforce be able to mold PostgreSQL to wean it from its dependence on Oracle.

Could Salesforce opt to tweak MongoDB or another NoSQL database? Sure, but it’s more likely that Salesforce would modify PostgreSQL to suit its needs than MongoDB, for a few reasons:

Although MongoDB is licensed under an open source license (AGPL version 3), it’s a license that raises question marks as to whether Salesforce could modify it and run a public service on top without either contributing those changes back to MongoDB (which it is unlikely to want to do) or paying MongoDB a great deal of money (also unlikely).

More important, while MongoDB is an excellent database (disclosure: I worked at MongoDB for a few years), it’s not as close a replacement for Oracle as PostgreSQL is. PostgreSQL is by no means a drop-in replacement for Oracle’s database, but a developer or DBA that is familiar with Oracle will find PostgreSQL similar.

Oracle would claim that it isn’t worried, but the DB-Engines database popularity ranking, which measures database popularity across a range of factors, should give it pause. For years, PostgreSQL has been on the rise, even as Oracle and MySQL (its open source database) have faded. PostgreSQL is now a strong fourth place, with MongoDB right behind it. If you talk to Silicon Valley startups and enterprise giants alike, you quickly see that PostgreSQL is having a “moment,” one that has been going on for years.

That moment, however, could become a serious movement with a tech bellwether like Salesforce behind it. If Salesforce jumped to PostgreSQL, or a variant thereof—or even if it managed to build a completely unrelated, custom database—that would be a serious signal to the rest of the Global 2000 that Oracle’s era of dominance is at an end.