r/programming • • Sep 24 '20

PostgreSQL 13 Released!

https://www.postgresql.org/about/news/2077/
1.3k Upvotes

236 comments sorted by

View all comments

60

u/tomma5o Sep 24 '20 edited Sep 24 '20

Sorry FE dev here, why you guys prefer postgreSQL over mySQL?

182

u/mobydikc Sep 24 '20 edited Sep 24 '20

SQL is just a language. Structured Query Language or something like that.

PostgreSQ, MySQL, MIcrosoft SQL Server, Oracle, are just some of the products that use SQL.

Postgres is free, open source, reliable, fast, and powerful.

edit the comment I replied to originally said "normal SQL" instead of "mySQL"

53

u/[deleted] Sep 24 '20

Note that yes, they all use "SQL", but that most non-trivial SQL you write will probably not be easily ported from one to the other. Because often you'll use server-specific functionality or syntax.

30

u/[deleted] Sep 24 '20

I don't agree with this statement. There may be small syntactical differences with window or aggregation functions, engine hints, and similar, but for simply writing queries, the overwhelming majority will be ANSI SQL or will have trivial differences that can be addressed with find-and-replace.

The real differences start when you get into stored procedures/temp tables/loops, and database administration tasks, including indexing.

I find the differences are highly overstated in general.

7

u/TemplateHuman Sep 24 '20

Why is there always someone that has to come in and be like “ACTUALLY...” while missing the point. He covered your argument by saying “non-trivial sql”. That’s the point. If it’s trivial it likely can be easily ported. Non-trivial sql would be stored procedures, ctes, functions, nested sub queries with grouping and joins, etc.

You’re just saying what he already said using specific examples.

-1

u/[deleted] Sep 24 '20

My point is that most SQL is trivial SQL.

1

u/BinaryRockStar Sep 24 '20

SELECT TOP 100 *

FROM Users

which SQL dialects does this work on? It's a trivial query so all of them right?

-3

u/[deleted] Sep 24 '20

Change it to LIMIT 100. Two seconds, done.

3

u/BinaryRockStar Sep 25 '20

Doesn't compile, LIMIT needs to be at the end of a MySQL statement.

Next is SELECT TOP 85 PERCENT. Works in MSSQL, nowhere else.

2

u/[deleted] Sep 25 '20

Yes, I didn't mention that, thought it was obvious. Again, a very simple change.

I have 10 years using T-SQL and I have never seen a TOP PERCENT in the wild.

My point was never that no changes are needed, but the changes are trivial in nature. The magnitude of these changes pale in comparison to those required for DBA-related tasks.

→ More replies (0)