News for hackers. Stuff that matters.
Re:MySQL 8.0 is now generally available by dancek on Thursday April 19, 2018 @10:33AM (#16876195)
There are some very useful features there, but I can't help but think that MySQL should have had them a long time ago.

Is there something MariaDB doesn't have? I'm genuinely curious as I've only really followed PostgreSQL development.

Re:MySQL 8.0 is now generally available by ayan on Thursday April 19, 2018 @02:46PM (#16878825)
I feel the same way. I've been using and tracking both since the mid to late 90s.

I've always wondering why, in a world where PostgreSQL exists, would anyone use MySQL. New releases seems to only slightly close the gap between it and better RDBMSs while retaining quite a few kludges and ambiguities.

In the meantime PostgreSQL gets better at the same pace.

Re:MySQL 8.0 is now generally available by evanelias on Thursday April 19, 2018 @06:18PM (#16880663)
MySQL is still a perfectly reasonable choice for massive-scale OLTP workloads. In my mind, a few things MySQL excels at:

* Threaded connection model. Postgres still uses process-per-conn right? This is very painful in situations with high connection churn / fire-and-forget db conns, which are required in some circumstances (heavily sharded environments where keeping persistent connection pools between all app servers and db servers is not practical)

* Ecosystem and experienced talent pool. Among companies with the largest database fleets, a plurality (maybe even a majority) use MySQL, or at least started out on MySQL. This translates to a greater availability of engineers worldwide with experience using and automating giant sharded MySQL fleets, more exposure to MySQL's edge cases, more familiarity with very specific performance characteristics and tuning, etc.

* MySQL's pluggable storage engine API allows flexibility for interesting future possibilities. Facebook migrated part of their MySQL fleet's storage engine from InnoDB (btree-based) to MyRocks (LSM-based) and achieved incredible compression benefits as a result, which translates to huge cost savings, while still being much easier than moving to another DBMS altogether. And AFAIK Postgres does not have comparable compression levels to MyRocks at this time.

* Replication options. I'm sure Postgres will catch up here, but its logical replication support is still relatively new, whereas MySQL has always used logical replication and supports a lot of different topologies and configurations. (Although, I won't cite master-master support as many folks do... it is not a good setup in MySQL and has long been discouraged in the community.)

* InnoDB's use of a clustered index for primary key means that it performs better than a non-clustered storage solution for some (many?) workloads.

Don't get me wrong, Postgres is a wonderful database and absolutely has many qualities and features that MySQL lacks. But it's not the black-and-white situation that some make it out to be.

Re:MySQL 8.0 is now generally available by sjwright on Thursday April 19, 2018 @11:46PM (#16882023)
And don't forget the TokuDB storage engine. It has some very interesting and different scaling/performance characteristics which can provide dramatic improvements for some workloads.

(Even though TokuDB is probably not the "best" choice for my workload, I love it for my text-heavy tables because its performance is still great and its on-disk compression ratios are superb.)

Re:MySQL 8.0 is now generally available by evanelias on Friday April 20, 2018 @10:40AM (#16885122)
Fair enough, but personally I would be very hesitant to adopt TokuDB for a new use-case in 2018. Its rate of development and adoption have both slowed considerably in recent years, and MyRocks covers similar use-cases.
Re:MySQL 8.0 is now generally available by sjwright on Thursday April 19, 2018 @11:38PM (#16881997)
> why, in a world where PostgreSQL exists, would anyone use MySQL.

You could also ask why would anyone use Postgres? Either question is equally absurd. If MySQL and its forks work well enough for Google, Facebook, Uber, AirBNB, Alibaba and Linkedin, why should anyone take it on face value that Postgres is an unambiguously better choice?

That said I've toyed with switching in the past. Ten years ago, the MySQL query optimiser was fairly junk and I wanted to switch for that alone.[1] The main thing that held me back was that my application has hundreds—quite probably thousands—of SQL queries coded into it.

Despite "SQL" being a notional standard, even the most basic queries would need to be extensively reformatted to be compatible with Postgres. The effort required to rewrite all of these queries simply can't be justified, particularly because we simply don't have any problems with MariaDB. The query optimiser is a lot better now, such that I now rarely encounter situations where a sensible query doesn't yield an efficient execution plan.

[1] Between 2000 and 2007 I had spent a lot of time with MSSQL for a different project and I had grown to appreciate its excellent query optimiser and execution plan visualiser. Ten years on and I still haven't seen any F/OSS solution that does as good a job as SQL Server 2000 in this regard. The most recent version I've used is 2005 so it might be even better today. And believe me, I was not a fan of Microsoft in the 2000s.

Re:MySQL 8.0 is now generally available by th3sly on Monday April 23, 2018 @03:15AM (#16901148)
regarding query plan visualizer, workbench has added one in recent years: https://dev.mysql.com/doc/workbench/en/wb-performance-explai...
Re:MySQL 8.0 is now generally available by kbenson on Thursday April 19, 2018 @05:32PM (#16880345)
Initial setup of users and permissions in MySQL is vastly simpler that in Postgres, IMO. It may seem like they are close, but in a world where pg_hba.conf ships with a config that easily confuses those that are unaware of Postgres's ident verification, you'll have people get frustrated often, and in a non-easy to diagnose way (at least for people at a familiarity level where they'll run into this).
Re:MySQL 8.0 is now generally available by gtowey on Thursday April 19, 2018 @06:36PM (#16880780)
This covers probably the most important reasons to use MySQL over PostgreSQL:

https://eng.uber.com/mysql-migration/

The TL;DR is that PostgreSQL on-disk storage format leads to much higher IOPs for the same workload. For companies running OLTP at scale, the cost differences can be huge.

Re:MySQL 8.0 is now generally available by PeterMikhailov on Thursday April 19, 2018 @11:32PM (#16881977)
I've been to a few talks from the PostgreSQL lead developers where they mention this.

Their opinion was mostly "Uber could have just asked us the right way to do it" and "We believe Uber's new engineering leader needed something to do"

Re:MySQL 8.0 is now generally available by greenhouse_gas on Thursday April 19, 2018 @03:53PM (#16879508)
1. LAMP - If you're working with shared hosting, there isn't much of a choice.

2. WordPress.

3. If you need something simple and basic, MySQL is much easier to get up and running.

Re:MySQL 8.0 is now generally available by nik736 on Thursday April 19, 2018 @04:41PM (#16879950)
I agree with 1 and 2 but I don't understand 3. Can you please elaborate?
Re:MySQL 8.0 is now generally available by greenhouse_gas on Thursday April 19, 2018 @09:24PM (#16881482)
I'm not a DBA, and it could very well be that it's because I'm coming from the LAMP world, but when I need something light and simple, MySQL or MariaDB fit the bill a lot more than Postgres.

In MySQL there are five steps: Install MySQL (creating root user at the same time), CREATE DATABASE X, USE DATABASE X, CREATE table Y, work.

If I need something more secure, I'll add a "Create User"/add permissions step in there.

For some reason, step 2-4 (create user and set up database/table) give me a headache in Postgres.

Re:MySQL 8.0 is now generally available by marcosdumay on Thursday April 19, 2018 @10:11PM (#16881654)
Install Postgres;

`su postgres` or whatever user it uses;

run `psql`;

`CREATE USER X IDENTIFIED BY PASSWORD;`

`CREATE DATABASE X OWNER X;'

Now X can connect there and add tables as he wishes.

Postgres onboarding coule be better, but it is naive to choose a tool you will use for years based on the first 5 minutes experience.

Re:MySQL 8.0 is now generally available by mgkimsal on Thursday April 19, 2018 @11:15PM (#16881919)
CREATE USER X IDENTIFIED BY PASSWORD

Googled that and not one result on the first page mentioned PostgreSQL. I don't think this approach is a common one at all. More to the point, I'm not sure i've ever seen that set of instructions anywhere, ever, for pgsql. Every tutorial and intro focuses on running 'createuser'.

Oh, yeah, and you'll need to be root to go in and futz with your pg_hba.conf file, then have permissions to write it out and restart the server (probably as root).

This 'createuser' approach hasn't been a '5 minute experience' - it's been the approach that is promoted as the default answer/approach almost everywhere I've ever looked for several years.

Re:MySQL 8.0 is now generally available by ptman on Friday April 20, 2018 @10:23AM (#16884976)

    \help CREATE USER

    \help CREATE DATABASE
Re:MySQL 8.0 is now generally available by youseecomrade on Thursday April 19, 2018 @09:43PM (#16881558)
Sounds like Postgres could use some initiative to make the experience easier/faster for beginners and new deployments (if popularity is something valuable for them). That's what many people value in MySQL apart from the familiarity.

I rarely come across tutorials for beginners where MySQL isn't treated like the only option, even if only by omission. I wouldn't be surprised if students only found out about the viability of different databases after a few years.

Re:MySQL 8.0 is now generally available by lstamour on Thursday April 19, 2018 @09:04PM (#16881419)
Biggest difference for me is that MySQL always pushed a simpler user structure while most *nix Postgres packages prefer having corresponding native OS users by default (PAM vs password auth). Also, it always seemed easier to migrate/upgrade MySQL data folders compared to Postgres ones. The specifics aren’t coming to mind right now, though. Finally I know way too many folks who prefer phpMyAdmin, especially when provided from their cheap shared hosting provider.

Don’t get me wrong, I prefer Postgres generally too, but I can definitely see wins to MySQL on ease-of-use. Especially the less standard but more forgiving SQL syntax and simple DESCRIBE commands. Yes the quirks add up for MySQL but Postgres has its share of quirks too.

Re:MySQL 8.0 is now generally available by rogerdpack on Thursday April 19, 2018 @06:58PM (#16880904)
I've had count(*) queries take like literally days in Postgres. Want to insert a lot of data? Expect it to cost a lot of RAM. It's got high features but some really rough edges too :|
Re:MySQL 8.0 is now generally available by zht on Thursday April 19, 2018 @08:27PM (#16881274)
the same would happen in MySQL right? select count(*) does a table scan
Re:MySQL 8.0 is now generally available by beberlei on Thursday April 19, 2018 @11:21PM (#16881935)
Depends on the storage engine afair, but both innodb an myisam have either index or global metadata based solution for this. I think in myisam its an estimste if you use count(*) so you need to use count(id) to get an exact value. This is all well documented
Re:MySQL 8.0 is now generally available by mfjordvald on Thursday April 19, 2018 @10:52PM (#16881832)
count(*) doesn't do full table scan as it's not tied to specific data. It has special handling logic. The only case where it might have to do a full table scan is if you try to count() on a specific (nullable?) column without an index.
Re:MySQL 8.0 is now generally available by zht on Friday April 20, 2018 @09:35AM (#16884622)
I've always had select count(*) do a full table scan (or at least take considerable time) in innodb... Did something change?
Re:MySQL 8.0 is now generally available by evanelias on Friday April 20, 2018 @10:36AM (#16885090)
Without a WHERE clause, select count(*) still does a full table scan (or full index scan) in InnoDB, and probably always will.

It is optimized in MyISAM via table-level metadata, which is only possible because MyISAM doesn't use MVCC or support transactions.

In InnoDB, you can get an estimated row count from SHOW TABLE STATUS, but the estimate is based on table stats and can be wildly inaccurate.

Re:MySQL 8.0 is now generally available by gaius on Thursday April 19, 2018 @03:44PM (#16879398)
I've always wondering why, in a world where PostgreSQL exists, would anyone use MySQL

I am a solid Postgres guy, but MySQL still has a better multi-master replication story. Confident that Postgres will eventually surpass it, possibly even in a later iteration of 10.

Now in a world where Postgres exists why would anyone use MongoDB is a valid question...

Re:MySQL 8.0 is now generally available by ptman on Friday April 20, 2018 @03:18AM (#16882777)
Postgres 11? Postgres 10 will only get bug fixes.

The version numbering was changed with 10

Re:MySQL 8.0 is now generally available by cdevnull on Thursday April 19, 2018 @12:28PM (#16877246)
The main reason I don't use mariaDb is the non support of nullable spatial index.

https://mariadb.com/kb/en/library/spatial-index/

Re:MySQL 8.0 is now generally available by meritt on Thursday April 19, 2018 @10:43AM (#16876290)
The big features that MySQL has been lacking, MariaDB has had since at least 10.2 (Apr 2016) or earlier. Specifically I'm talking about Windowing functions, CTEs, JSON support, GIS support, Metadata in transactions (DDL statements).

At this point MySQL is playing catch-up to MariaDB.

Re:MySQL 8.0 is now generally available by morgo on Thursday April 19, 2018 @11:21AM (#16876635)
Former MySQL Product Manager here (no longer affiliated). To cover your specifics:

MySQL was first in offering JSON with 5.7. It is still well ahead, for example, there is no JSON_TABLE, aggregate functions, native type or partial update in MariaDB. Some examples of the value here: https://mysqlserverteam.com/mysql-8-0-from-sql-tables-to-jso...

Both have always had GIS support, but have taken it in a different direction. With MySQL, the GIS is now based on Boost.Geometry and has Geography support.

w.r.t. metadata in transactions - I am not sure which feature you refer to here. The native innodb-based dictionary is a MySQL only feature.

For Window functions and CTEs, they were added at a similar time, but MySQL is on a ~3yr release cycle. MariaDB is on a ~1yr.

Re:MySQL 8.0 is now generally available by meritt on Thursday April 19, 2018 @11:44AM (#16876841)
> I am not sure which feature you refer to here

The same complaint that every single person brings up about MySQL when being compared to Postgres, including in this thread: DDL changes made during transactions cannot be rolled back.

Re:MySQL 8.0 is now generally available by morgo on Thursday April 19, 2018 @11:48AM (#16876872)
MariaDB does not have that feature: https://mariadb.atlassian.net/browse/MDEV-4259
Re:MySQL 8.0 is now generally available by willvarfar on Thursday April 19, 2018 @11:45AM (#16876847)
Mariadb has JSON it just doesn't call it that - it's terminology is dynamic columns.

Source: have code that works on both.

Re:MySQL 8.0 is now generally available by johannes1234321 on Thursday April 19, 2018 @11:52AM (#16876908)
There s a difference: MySQL has specific a datatype for JSON aside from only having JSON-related functions working n strings, which has a few benefits:

* The JSON datatype guarantees the content is valid JSON

* access to fields can be faster even without dynamic/virtual columns

* since 8.0 there are special optimizations for doing partial updates, which means that not the full JSON data has to be rewritten on small changes https://mysqlserverteam.com/partial-update-of-json-values/

Re:MySQL 8.0 is now generally available by morgo on Thursday April 19, 2018 @11:52AM (#16876906)
It has both (now). It's a stretch to say Dynamic columns are on the same level. For example, could you index them with virtual generated columns? The syntax is also not as transparent to applications as the ->> JSON operator.
Re:MySQL 8.0 is now generally available by willvarfar on Thursday April 19, 2018 @12:17PM (#16877145)
Oracle owns the JavaScript trademark and has started enforcing it. Kinda wise in hindsight that Mariadb didn't call it json?

I think Mariadb was there first. I think the format is very similar at the bit level, but the MySQL has nicer API with automatic returning it as text to apps rather than exposing the bits. I dislike json_extract and wish >> worked but it doesn't seem to on my percona server :(

Anyhow, you'll look back when you've got more distance from Oracle and realize that you don't need to try and convince yourself that MySQL was better quite so hard ;)

Re:MySQL 8.0 is now generally available by morgo on Thursday April 19, 2018 @12:29PM (#16877255)
JSON is part of the SQL 2016 standard and exists in other databases as well. I don't see how the trademark is relevant here.

I wish we could be more civil and not resort to petty insults. Is there anything I wrote you can dispute with a source?

Re:MySQL 8.0 is now generally available by go_prodev on Thursday April 19, 2018 @10:39AM (#16876246)
No, at this point Maria has surpassed MySQL, however over time we'll likely see the two diverge as MySQL creates new storage types and heads in a different strategic direction.
Re:MySQL 8.0 is now generally available by petre on Thursday April 19, 2018 @10:12PM (#16881659)
> Is there something MariaDB doesn't have?

  * Proper native JSON support
  * Spatial support lags behind MySQL
However we are still using it in production and MySQL 8 is a no go given that it removed MyISAM support. We still use MyISAM due to fast inserts and easy backup (just copy the files). We use MariaDB for storing IoT time series data.
Re:MySQL 8.0 is now generally available by sjwright on Thursday April 19, 2018 @11:54PM (#16882053)
Have you explored the TokuDB storage engine? Or Aria?
Re:MySQL 8.0 is now generally available by petre on Friday April 20, 2018 @01:02AM (#16882264)
Yes. Aria is one of the reasons we are using MariaDB in fact. It offers a great migration path from MyISAM. We migrated from MySQL 4.6, that's why our tables are in fact MyISAM. We currently have a test server running using Aria tables.

I have also thought about using TokuDB but SuSE (13.2) didn't ship a module for it then. I have to check again in 42.3.

The only real issues with MariaDB is lack of proper JSON and spatial support which would be of great use to us. I'm talking about a real JSON data type with validation and means to query and maybe even replace JSON, not a mere alias for the LONGTEXT data type.

We intend to switch to Postgres on the long run. It has everything we want, moreso with TimescaleDB extensions which could proove very useful for storing time series data. We are currently using it for the spatial database.