I've seen a lot of developers here use Postgres over MySQL.
I personally like MySQL more for my side projects because I can be faster up and running.
What makes me crazy about Postgres is that during tests when I truncate table I need to manually re-initiate sequences.
So guys... If you like Postgres more than MySQL share your experience why.
I use Postgres because of jsonb, postgis, recursive CTEs, the great functions that come with it etc. I realise MySQL has equivalents now but they're not so better I'd change back.
TRUNCATE TABLE foo RESTART IDENTITYshould fix what makes you crazy :)We use jsonb too
I've used both, but to be honest I usually stick with MySQL.
It seemed like the obvious choice several years ago when I started and I never questioned my choice since then. I've yet to find a use case that would make me switch. And I guess for my general websites there's hardly a reason to make the switch.
This is exactly my situation. No reason to switch for me.
I've only done a couple of projects with them, but moved to Postgres because MySql now has mixed licensing that include GNU and proprietary agreements.
I have used both for websites with relatively high traffic.
In my experience, MySQL was crashing and using up server's RAM and CPU much more than PostgreSQL. PostgreSQL seemed to be more stable and better performing. In addition, PostgreSQL has JSON fields, PostGIS extensions for mapping, UUID fields, and some other cool features.
The only thing that seems to me better about MySQL is that there are more client apps to manage it and usually they are more intuitive. Some of them worth mentioning are Sequel Pro (https://www.sequelpro.com/) and HeidiSQL (https://www.heidisql.com/).
read somewhere on Twitter. (couldn't find the tweet)
Postgres is the Linux of databases.
Postgres all the way. The array and JSON fields are great, but my favorite feature is that DDL scripts are transactional.
I like Postgres for its Array and JSON fields. I do sometimes need these in my apps, but I'm quite cautious about NoSQL databases.
I did not know that Postgres has a JSON field type. How does it work? Can you say that, with a JSON type, it is like having a SQL and NOSQL database all in one?
Yeap, it is almost like having a SQL and NoSQL database in one. You can index specific fields within the JSON field, you can query the structure. It's awesome.
Hm... interesting. Never heard about this, thanks for the pointer.
Most features that distinguish database engines are very rarely visible for simple applications. Therefore you can pick whatever SQL or NoSQL database you prefer and that is fine. However, if you venture into the territories of 100+ billion-row tables, 100+ TB databases, 2000+ line complex SQL queries, 200k+ active connections then you start to reevaluate what is important. In my line of work, the question always was whether we use Oracle and pay the price or experiment with Postgresql. Over the years, Postgres was more and more a natural choice for these large analytical applications. Few features which helped us are:
Also Postgres extensibility helps to create your own data or index types which led to derivative products recently like: CitusDB, Timescale DB that I used. I think about PG more like an application development platform than a database.
I used to use MySQL but I didn't see much difference between MySQL and PostgreSQL. I made the switch to NoSQL and I use Mongo now because I like the document-oriented storage.
I used to stand behind MySQL until I had to deploy it a couple times. I dunno how much blame I can put on MySQL but after spending several nights failing to get external connections to work I ditched in for Postgres. Postgres was a lot easier to set up and I haven't looked back since.
Practical reason: several managed DB services only offer Postgres (eg Heroku, Digital Ocean, etc). This is not true across the board as many also offer MySQL.
Personally: we used Postgres in my Databases course in college and I've stuck with it since.
No preference here, Postgres is doing a lot of great things. MySQL / MariaDB has served me well in the past as well.
Regarding your testing issue, perhaps delete the data outright instead of truncating the table?
Do you mean to completely delete the table?
No, meant, instead of formally truncating the table, informally deleting all of the rows (leaving the table intact). Truncation resets any incremental keys, if you don't rely on that side effect in your test, I would think that just removing the data you created would be sufficient enough?
It's because all the developers are using it. All the well-defined docs like DigitalOcean and other popular docs promoting PostgreSQL.
It's not that hard to set up and readily available in the Linux machine. In case if you want some No SQL functionality you can use PostgreSQL as no-sql.
As one of "all the developers" out there... I don't use it, so your statement is a bit overzealous.
Most hosting services out there are heavily documenting both MySQL/MariaDB as well as Postgres AS WELL AS NoSQL offerings because it's a solid content strategy and not necessarily because of some sort of endorsement.
DO rolled out a managed PG database before MySQL and Redis, but they didn't leave those other technologies out in the cold.
Everything you described about Postgres in terms of availability (MariaDB is everywhere in Linux-land) and functionality (I assume you mean JSON support and perhaps things like in-memory tables?) can be satisfied by MySQL.
That's not to say I'm team MariaDB because I'm not, I'm more of a MongoDB + Redis guy for my own personal projects.
MongoDB + Redis ( both NoSQL ) right? Can you tell me how your frontend stack will be?
New projects for me tend to look like this:
Infrastructure usually looks like this
I tend to not use the term NoSQL because it's a bit more of a buzz word. MongoDB and Redis are both non-RDBMS, but each functions different, thus neither fits nicely into a generic "No-SQL" title (outside of just being contrarian to RDBMS).
MongoDB functions more in line with a traditional database with a more JavaScript fluent query language and the gotcha of non-ACID compliance depending on the version and configuration.
Redis lives wholly in memory and is simply a key/value store. This replaced Memcached for me years ago due to it's more complex data structures outside of simply get/set on a key.
I was confused with user management in Postgres and found the one used in Mysql simpler to understand and handle. Currently using Postgres only in one project that was a requirement from the client.
Yeah, In the large projects it may difficult. I was using this simple guide for almost five years. https://gist.github.com/rajasimon/4c6e2b7219d814991bc3 Hope this helps.
Thanks @rajasimon That's helpful.
This comment was deleted 7 years ago
This comment was deleted 6 years ago
How specifically is Postgres better at data integrity?
(To be clear, I am not challenging you on your statement, I am asking an honest question.)
This comment was deleted 6 years ago
Thanks for elaborating.