[HN Gopher] MySQL for Developers
       ___________________________________________________________________
        
       MySQL for Developers
        
       Author : AYBABTME
       Score  : 294 points
       Date   : 2023-03-21 15:05 UTC (7 hours ago)
        
 (HTM) web link (planetscale.com)
 (TXT) w3m dump (planetscale.com)
        
       | KronisLV wrote:
       | It's really nice to see more content for MySQL/MariaDB still
       | being made, since it feels like they are still good solutions for
       | a whole variety of situations! While I might look in the
       | direction of PostgreSQL for more advanced in-database processing,
       | for most CRUD apps the aforementioned two are going to be more
       | than enough!
        
         | hu3 wrote:
         | > _While I might look in the direction of PostgreSQL for more
         | advanced in-database processing, for most CRUD apps the
         | aforementioned two are going to be more than enough_
         | 
         | I see this sentiment often here on HN. Something long the lines
         | of "MySQL is enough for small apps but you want PotgreSQL for
         | serious work."
         | 
         | When in practice I find the opposite to be true. PotgreSQL is
         | hard to scale and hard to upgrade when compared to MySQL. I
         | mean, just take a look at the caliber of companies that
         | leverage MySQL at scale using Vitess to orchestrate it
         | (spoiler, it powers Youtube, GitHub, Slack, Shopify and more):
         | 
         | https://planetscale.com/vitess
         | 
         | What's PostgreSQL comparable list?
        
           | mulmen wrote:
           | > What's PostgreSQL comparable list?
           | 
           | Netflix, Uber, Instagram, Spotify, Skype, Reddit, Twitch,
           | Yahoo.
        
           | KronisLV wrote:
           | > What's PostgreSQL comparable list?
           | 
           | I'm sure that others can comment on that, but in my
           | experience PL/pgSQL is the killer feature that's hard to beat
           | in PostgreSQL, for those cases where you want to store some
           | amount of logic in the database itself (MySQL stored
           | procedures feel a bit more limited). That said, it's not even
           | the only procedural language that is available:
           | https://www.postgresql.org/docs/current/xplang.html
           | 
           | In addition, working with JSON in PostgreSQL can be pretty
           | nice for niche use cases, as is using PostGIS for geospatial
           | data, in addition to some of the REST (e.g. PostgREST) or
           | GraphQL (e.g. PostGraphile) projects, if you want to interact
           | with the database as something that exposes web endpoints to
           | let you retrieve and manipulate data directly, as opposed to
           | just SQL communication with some back end.
           | 
           | That's not to say that MySQL or MariaDB don't have their own
           | great offerings, but it's clear that PostgreSQL has gotten a
           | lot of love in regards to people developing various
           | integrations and extensions. That said, usually not needing
           | the equivalent of PgBouncer out of the box is nice and
           | personally MySQL Workbench feels better than pgAdmin due to
           | the advanced ER functionality (forwards/backwards engineering
           | and schema synchronization, so that you can create versioned
           | DB migrations more easily if you write them in plain SQL).
           | 
           | Edit: as for some crowd sourced data, a quick search turned
           | up this from a few years ago:
           | https://learnsql.com/blog/companies-that-use-postgresql-
           | in-b...
           | 
           | But then again, all of the mentioned RDBMSes have proven
           | themselves as viable for a variety of projects.
        
         | AYBABTME wrote:
         | If by "advanced in-database processing" you mean stuff like
         | PostGIS, then yes PostgreSQL is the right approach. But for
         | most people building web-apps to scale, or established
         | businesses who want to pick a solution and stick to it for
         | basically ever, MySQL is much easier to scale. There's a ton of
         | companies running MySQL at scale. I never heard of the same for
         | Postgres, and for a long while I had an intellectual preference
         | for Postgres as being the more "pure" implementation.
         | Experience in the field showed me that MySQL, despite its
         | flaws, is the name of the game.
         | 
         | Further "evidence" by referring to other experienced folks who
         | worked on scaling SQL databases, and MySQL is what's used and
         | what folks have experience with:                  -
         | https://twitter.com/Sirupsen/status/1602347646961606656
         | - https://blog.nelhage.com/post/some-opinionated-sql-takes/#my-
         | personal-choice-mysql
        
           | paulryanrogers wrote:
           | MySQL also has had major bugs in recent GA releases like
           | crashing your server when renaming a table.
           | 
           | PostgreSQL scales differently since it doesn't have redo-log
           | based MVCC or other things as well. It does value correctness
           | and has (mostly) better defaults. It has also had its own
           | embarrassing bugs, though IME few put data integrity or
           | availability at risk.
        
       | aarondf wrote:
       | Hey HN, I made this course :D
       | 
       | The course is a bit more than 7 hours long split over 64 videos.
       | 
       | I was always frustrated by the lack of intermediate database
       | content, it seemed like it was mostly intro stuff, or straight to
       | DBA level. So I read as many database books as I could, read
       | through the official docs, and made this course specifically for
       | application developers.
       | 
       | If yall have any feedback I'd love to hear it. I'll be making
       | updates soon, but not before I take a nice long break from
       | editing video.
        
         | jordanmoconnor wrote:
         | Nice work! Congrats on shipping it
        
         | asddubs wrote:
         | Since you call it intermediate level, would you recommend it
         | for people who are already familiar with the basics of MySQL?
         | Would someone who has no problem formulating a query to get any
         | given result from a database and knows the basics of how to
         | create indexes still learn anything new from this?
        
           | aarondf wrote:
           | Yeah, I think you would still learn some good stuff! I go
           | pretty deep into indexes and do some fun stuff with generated
           | columns, windows, and CTEs. Based on your comment, you're the
           | person I was hoping to hit! So if you do watch it, lemme know
           | what you think
        
         | mijustin wrote:
         | This is well done! I can see that you've done your research:
         | you've synthesized so much of the written material on MySQL
         | (books, docs) in each lesson. Makes learning these concepts
         | really accessible.
        
           | aarondf wrote:
           | Thank you Justin, that was 100% my intent so that's
           | encouraging to hear. There is a _ton_ of good information,
           | but man so much of it is irrelevant for application
           | developers (as opposed to DBAs). Hopefully this fills that
           | gap!
        
         | geekodour wrote:
         | Thanks for making this Aaron. content looks so good! just in
         | time for me. Unfortunately getting "Sorry Because of its
         | privacy settings, this video cannot be played here.", unsure
         | what's up.
        
           | aarondf wrote:
           | Uh oh! That shouldn't be the case. Where are you viewing
           | from? And what browser? I might need to change some settings
           | in Vimeo
        
             | geekodour wrote:
             | Ah it's for sure some browser extension, it's playing fine
             | in a FF private window. my bad. Will post back once I
             | figure out what's causing it. Again, thanks for the awesome
             | stuff!
        
               | aarondf wrote:
               | Whew, that's a relief. Keep me posted if you find out
               | it's on our side.
        
               | geekodour wrote:
               | okay totally on my side: it was uMatrix :)
               | https://github.com/gorhill/uMatrix/wiki/Per-scope-
               | switches#r...
        
         | SadWebDeveloper wrote:
         | Quite difficult to review that many hours of video but from the
         | syllabus there are probably some missing pieces, mainly stored
         | procedures and triggers, yes i know MySQL sucks for that
         | particular job and probably you didn't touch them because
         | planetscale probably doesn't support them (not a planetscale
         | dev but this is my wild guess).
         | 
         | Also didn't see any topic on choosing the right
         | charset/collation for the right data and why.
        
           | aarondf wrote:
           | Oh there are definitely missing pieces! I tried to cover the
           | "meaty middle" of what application developers usually need to
           | know. I did not cover stored procedures and triggers.
           | 
           | I did cover CTEs and windows, which are not yet supported by
           | PlanetScale. I also covered foreign key constraints, which
           | are not yet supported by PlanetScale.
           | 
           | As far as charset and collation, I cover that a bit in the
           | "strings" video of the "Schema" section.
           | 
           | Let me know if you have any other feedback!
        
           | Aeolun wrote:
           | But then, most devs wouldn't want their procedures inside the
           | database anyway (with attendant lack of
           | integration/versioning).
        
         | ano88888 wrote:
         | this is great. Thank you so much for your effort. Really
         | appreciate it. By the way , if you are starting a startup, will
         | you use mysql or postresql and why assuming you are equally
         | good at both ?
        
         | ndstephens wrote:
         | This looks great!! Hopefully you can answer a couple questions
         | for me.
         | 
         | You mention you're using TablePlus. Doesn't look like it has a
         | free option. Can you recommend another similar database GUI
         | tool so I can "code along"? And is there a database I can
         | connect to and work with? Maybe you answer these at some point
         | in the course, but I didn't see anything in the intro.
         | 
         | Also you mention this is for devs and not DBA's. Do you go over
         | strategies for creating and "maintaining" a new db for a basic
         | app? Or is this for a dev to work against a db that fully
         | created and maintained by a DBA? I'm interested in using
         | PlanetScale for hobby projects, so i'm currently trying to
         | learn about not just using a db, but also being my own DBA (on
         | a very small and basic scale).
         | 
         | Thank you for the course and any feedback on my questions.
        
           | aarondf wrote:
           | Hey there! Looks like the TablePlus question was answered
           | below. I don't cover connecting to a database and coding
           | along, but that's a good idea. I'll see if I can get the
           | sample data up somewhere for y'all to download.
           | 
           | > Also you mention this is for devs and not DBA's. Do you go
           | over strategies for creating and "maintaining" a new db for a
           | basic app?
           | 
           | We do spend a lot of time talking about schema up front
           | actually! What it takes to design good tables, what data
           | types to use, and so on. I talk at the end of the schema
           | section about migrations and how you can use those to keep
           | your tables up to date as business requirements change over
           | time.
           | 
           | I think if you use a hosted provider like PlanetScale, they
           | (we) take care of a lot of the stuff that was traditionally
           | the realm of the DBA, although maybe not all of it. I don't
           | know exactly where to draw the DBA line to be honest.
           | 
           | Let me know if you have any other questions! Happy to help
           | however I can.
        
           | saluki wrote:
           | Table Plus (Free Trial Version) What are the limitations of
           | the free trial? The free trial is limited to 2 opened tabs, 2
           | opened windows, 2 advanced filters (filters are not available
           | on the free TablePlus Windows) at a time. We can change the
           | limitations without any notifications in the future releases.
        
             | ndstephens wrote:
             | Maybe i'm reading into their naming incorrectly. Free
             | "trial" to me sounds like it's time based...as in after a
             | week you can no longer use it and must buy. I'll give it a
             | try.
        
               | tough wrote:
               | It's not time based, only feature based, if you don't
               | need lots of open tabs you can survive it it's only a bit
               | annoying
               | 
               | Beekeeper Studio similarly has a (community edition) and
               | it's GPLv3 licensed
        
               | ndstephens wrote:
               | thanks for the recommendation. will check it out
        
       | MangoCoffee wrote:
       | nice. i use MS SQL at work and MySql for personal project
        
         | tracker1 wrote:
         | Might be worth looking into PostgreSQL as well. It's just as
         | readily containerized (docker) as well as being more ANSI
         | compliant and consistent. I only say this because nearly every
         | time I've ever used MySQL, I find annoyances.
         | 
         | Such as the fact that 'utf8' isn't 'utf8', 'utf8mb4' is... the
         | feature was in testing as utf8 was being standardized and mysql
         | used 'utf8mb3', and never updated the reference for 'utf8' for
         | compatibility, even across major versions.
         | 
         | There's also the fact that collation on indexes for binary
         | fields are case-insensitive if your default collation is, even
         | if it's "binary".
         | 
         | Also, PostgreSQL has nicer support, imo, for JSON (JSONB) data,
         | as well as a rich extension ecosystem.
        
           | johannes1234321 wrote:
           | > Also, PostgreSQL has nicer support, imo, for JSON (JSONB)
           | data, as well as a rich extension ecosystem.
           | 
           | MySQL's JSON data type, which exists since 5.7, which is
           | quite old, is a solutely comparable to PostgreSQL's JSONB.
           | (But don't be confused by MariaDB, which is a MySQL fork,
           | where JSON is an alias to MEDIUMTEXT or something like that
           | with little snytax validation)
        
           | mschuster91 wrote:
           | PostgreSQL, however, is one hell of a PITA to upgrade.
           | Keeping a cluster of MySQL machines alive is way easier than
           | PostgreSQL, not to mention how easy it is to shoot yourself
           | in the foot with its authentication mechanisms.
        
           | manv1 wrote:
           | PosgreSQL has its share of annoyances, like case preserving
           | case insensitivity and inconsistent naming of its
           | tools/config files.
           | 
           | Nothing like trying to do a select on a table/column that you
           | know is there and getting an error...becuase the table/column
           | was created with quotes by your ORM so it doesn't
           | automagically get case in-sensitized.
           | 
           | It's maddening.
        
             | anamexis wrote:
             | I would never have expected any identifiers to be case
             | insensitive, personally.
        
       | tracker1 wrote:
       | Can't really comment on the material... but a minor suggestion
       | might be to have a section on ANSI-SQL statements and quotes, and
       | where mySQL/MariaDB breaks the standard (such as foreign key
       | references in table creation). As well as pointing out that you
       | should use 'utf8mb4' for UTF-8, and not 'utf8' encoding.
        
       | hogya006 wrote:
       | I was always frustrated by the lack of intermediate database
       | content, it seemed like it was mostly intro stuff, or straight to
       | DBA level. So I read as many database books as I could, read
       | through the official docs, and made this course specifically for
       | application developers.
        
         | swarnie wrote:
         | What's up with this being a copy paste of a comment above also
         | claiming to be the creator?
        
           | aarondf wrote:
           | Ha I was waiting for it to be edited, I thought they pulled
           | the trigger too soon... but guess not?
        
       | porker wrote:
       | Does anyone know of a similar intro course for Clickhouse?
        
         | tylerhannan wrote:
         | Starting here is probably useful...
         | 
         | https://learn.clickhouse.com/visitor_catalog_class/show/9134...
         | 
         | But there is quite a bit on learn.clickhouse ;) And if
         | something is missing, tell us.
        
         | JonoBB wrote:
         | I've just got started with Clickhouse, and their docs are
         | excellent. Quick Start guide and tutorials are very well
         | written.
         | 
         | Also, be prepared to be blown away with Clickhouse. I've not
         | seen many (any?) technologies that impressed me this much right
         | out the box.
        
       | pratikch1253 wrote:
       | This is perfect I was looking for something like this will
       | definitely be checking it out over this weekend one request
       | please give us the training data set you use for this course so
       | that we can follow along with all the sql queries you are typing.
        
         | aarondf wrote:
         | This is a great idea. Let me see how quickly I can get that
         | done.
        
       | michaelbuckbee wrote:
       | This is outstanding.
       | 
       | I've always felt that one of the big "level ups" that an app
       | developer can do is get a better understanding of how databases
       | work and how/when to leverage their features.
       | 
       | The course kind of feels like cheating as it's so much less
       | effort than slogging through all the books and failed projects
       | you'd otherwise need to get the experience.
        
       | Alifatisk wrote:
       | The quality is astonishing, is this really for free?
        
         | paxys wrote:
         | The "cost" is that you may consider using Planetscale for your
         | next project/company. So a win-win really.
        
       | nbosscher wrote:
       | This is amazing! I've been following Aaron's short database
       | videos on Twitter and he is the real deal. Accessible,
       | straightforward explanations of complex db stuff. I highly
       | recommend checking this out.
        
         | aarondf wrote:
         | Thanks Nate! Excited to get back to _short_ form videos haha. I
         | 'm done with long form for a little bit
        
       | crooked-v wrote:
       | A lot of devs should really be more familiar with plain ol' SQL
       | databases. I've been at multiple companies where people have
       | jumped to elaborate, gigantic, overcomplicated projects
       | preemptively designed to scale to ten billion people, that could
       | have instead been driven entirely by a single big MySQL or
       | Postgres database set up in a day or two instead of a month.
        
       | mjwhansen wrote:
       | Awesome!
        
       | mokkol wrote:
       | Wow, that is some awesome quality & quantity. I can't believe
       | this is for free!
       | 
       | Well done!
        
       | ingenika wrote:
       | I don't know why lots of website use dark theme, I just found
       | that dark theme is not very readable during daytime.
        
       | whitepoplar wrote:
       | Cool! Now we need this for Postgres.
        
         | manv1 wrote:
         | You mean postgres | postgreSQL | pg | pgsql?
        
         | winrid wrote:
         | Their product is for MySQL, so I doubt we'll see that soon.
        
         | blowski wrote:
         | The Art of Postgres is probably it.
         | https://theartofpostgresql.com/
        
           | systems wrote:
           | The Art of Postgresql is a book not a video course And
           | unfortunately they dont provide to table of content on the
           | site
        
             | paxys wrote:
             | Also, while we may see $75 or $150 or whatever as throwaway
             | money (especially in the context of professional help
             | products or books), that price is wildly unaffordable for
             | most of the planet. Having high-quality free educational
             | material out there is a godsend for students and developers
             | in low income countries.
        
               | craigkerstiens wrote:
               | The Art of PostgreSQL is great and super thorough.
               | Knowing the author I can't fault him on price for the
               | effort he put into it.
               | 
               | But also your point of students and developers in low
               | income countries completely understand that side. It's a
               | shameless plug but we built our Postgres playground with
               | tutorials on a number of topics which are completely free
               | aiming to help target some of that audience -
               | https://www.crunchydata.com/developers/tutorials
        
         | elforce002 wrote:
         | 100x this.
        
         | acomjean wrote:
         | I've been using MySQL. Is Postgres so different now that the
         | SQL here won't work? (It may be that it's MYSQL that's
         | different)
         | 
         | I know there are some differences in SQL syntax, but in my case
         | we use pretty basic sql...
        
           | pphysch wrote:
           | Outside of SQL they are different technologies.
           | 
           | MySQL mingles its custom language with SQL which is a common
           | point of confusion... Whom amongst us wasn't confused when
           | "DESCRIBE" didn't work in SQLite or Postgres?
        
             | FinalBriefing wrote:
             | Are they really different technologies? It has always been
             | my impression that they are the same tech, but they have a
             | slightly different syntax in some places (DESCRIBE) and
             | different levels of capabilities (Postgres offers more).
             | 
             | If you know the core concepts of one, you are probably 80%
             | good to go with the other.
        
               | [deleted]
        
               | wlll wrote:
               | > Are they really different technologies?
               | 
               | Yes, your impression is wrong.
        
             | [deleted]
        
           | [deleted]
        
         | aarondf wrote:
         | I agree, there's a huge desire for this! I don't know the first
         | thing about Postgres though, so it's not gonna be me :)
         | 
         | There's an opportunity for a creator here.
        
       | benatkin wrote:
       | TL;DR starting with a list of the data types before querying the
       | data is putting the cart before the horse IMO.
       | 
       | It seems a bit like DuoLingo. You learn a random assortment of
       | facts, rather than being exposed to what people are actually
       | doing. I learned MySQL by example and this is far from it. I
       | don't recommend learning about the schema or the data types
       | first, unless you're just being shown a CREATE TABLE statement
       | with just the types you need in order to go through a CRUD
       | example (having you start with a table that already exists and do
       | a SELECT query first is also good). Otherwise, like with
       | DuoLingo, you'll likely get bored, unless the reward mechanism
       | grabs you. (DuoLingo is fully gamified. This has a bunch of short
       | steps so you can watch yourself progress through them.)
        
         | testudovictoria wrote:
         | The creator posted this elsewhere in the comments:
         | 
         | > _it seemed like it was mostly intro stuff, or straight to DBA
         | level_
         | 
         | This would have been perfect for someone like me a few years
         | ago. I went into my first job knowing how to make simple
         | queries and simple joins. I changed jobs into a legacy system
         | where there was an overwhelming amount of data sharded across
         | few databases and several hundred schemas.
         | 
         | I didn't need to learn how to do simple joins or basic keywords
         | like union and intersect that every tutorial talked about. I
         | also didn't need a bunch of DBA knowledge like distribution
         | strategies, replication, and HA techniques. I needed to learn
         | how to leverage what was in the database to pull the exact data
         | I needed more efficiently than what I was doing - windows,
         | cursors, and good subqueries. I was the type of person being
         | addressed.
        
       | ksec wrote:
       | It is nice MySQL finally reach the front page on HN. Considering
       | MySQL is extremely unpopular among folks here.
       | 
       | I will take this rare opportunity to ask, anyone knows when MySQL
       | 9.0 is coming?
        
       | realchrissean wrote:
       | This is very well done Aaron. I'm curious how long did it take
       | you to create this from start to finish?
        
         | fasteo wrote:
         | I am also curious
        
         | aarondf wrote:
         | Thank you! I shared a little about the process on twitter here:
         | https://twitter.com/aarondfrancis/status/1638191349261377539.
         | 
         | Start to finish... a long, long time. 18 months on and off, 4
         | months full time. I started this before I was employed at
         | PlanetScale and when I joined PS the course came along with me.
         | I wouldn't have had the space to do it if it hadn't been my
         | full time job. For the past four months or so I've been
         | spending 100% of my work time on it, and much of my spare time.
         | 
         | Part of what made it tough is that, while I've been comfortable
         | with MySQL for a long time, _teaching_ it is a whole different
         | thing. So I ended up having to study a _ton_. Lots and lots of
         | videos trashed when I got to a point of explaining something
         | and realized I didn't know it well enough to teach. Back to the
         | docs to figure it out myself and then back to recording.
         | 
         | I could do it again in about 1/3rd the time, but of course I
         | could! I've done all the hard parts now! The actual recording
         | and editing was of course hard, but the up front work to make
         | sure I wasn't making stuff up was probably the biggest slog of
         | it all.
        
           | chernevik wrote:
           | I've taught courses on SQL to newbies and learned a lot from
           | it.
           | 
           | My rule for the slide deck was "don't use a term you haven't
           | explained". So I'd write a slide and check for new words. If
           | I really needed them I'd have to add a slide before that
           | introduced and explained the term.
           | 
           | Figuring out exercises that got students oriented to the
           | concepts was another trick. People really don't get stuff
           | until they've done it for themselves.
           | 
           | By the end of the second day I had people writing joins on
           | their own.
        
       | swyx wrote:
       | this was both highly anticipated and has been excellently
       | executed. incredible amazing work. thanks Aaron!
        
         | aarondf wrote:
         | Thanks swyx! Means a lot coming from you. We're lucky to have
         | an incredible team at PlanetScale to help me pull off such a
         | huge lift. We had maybe 5 or 6 people building out the website
         | and 5 or 6 people that reviewed the content for technical
         | accuracy. No way I could've done it solo.
        
       | nidnogg wrote:
       | Is this really free? I can't quite put my finger on it but it
       | seems so...high quality?
       | 
       | Kudos to Aaron though, will gladly dive in later on
        
         | aarondf wrote:
         | Haha thank you! I'm really grateful that everyone at
         | PlanetScale gave me _so_ much time to work on this. We're
         | really committed to doing everything as high quality as we can,
         | even the free stuff. Let me know what you think!
        
         | aculver wrote:
         | Yeah, you're not alone. Aaron posted a thread on Twitter that
         | shares the inside skinny on what it took to ship this course
         | (https://twitter.com/aarondfrancis/status/1638191349261377539)
         | but I had an early peek into the work he was doing on this
         | course, and there was a clear inflection point in the project
         | when he joined Planetscale and had the benefit of being able to
         | focus a substantial amount of his time on it in addition to all
         | the work other members of the team there were able to
         | contribute to it. Very grateful that Planetscale unlocked this
         | so it's available as a free resource instead of having to be
         | behind a paywall to support its creator.
        
       | ilrwbwrkhv wrote:
       | Is there a full chapter by chapter contents?
        
       | boboroshi wrote:
       | This looks amazing. Definitely something I'm going to dive into
       | and level up on my SQL skills.
        
       | igtztorrero wrote:
       | Super Tutorial !!! Thanks
        
       ___________________________________________________________________
       (page generated 2023-03-21 23:00 UTC)