Let's learn about Bulk Insert in Relational Databases using Go/Golang specifically using the "pgx" package, but also why using the concrete database engine is better than using a bunch of INSERT commands via "database/sql"
This episode covers the concrete methods defined in "pgx" to deal with Bulk Inserts, specifically using the COPY command via the "Conn.CopyFrom" method that requires the following:
* tableName Identifier
* columnNames []string
* rowSrc CopyFromSource
Where "CopyFromSource" is a type that we must implement, sort of a reader that indicates "pgx" how to deal with the individual records.
== Relevant links
* Example code: https://github.com/MarioCarrion/videos/tree/35b85432ad8d8ceebff79eff684a49a6f9810b94/2021/12/02
* Relational Databases - Bulk Insert - https://youtu.be/FaXtQy98V7M
* PostgreSQL driver and toolkit for Go: https://github.com/jackc/pgx
* Previous Episode: "Learning Golang: Relational Databases - Transactions with PostgreSQL": https://youtu.be/BLr2V6zB5k4
* "Software Architecture in Golang: Security - Databases, SQL Injection and Permissions" https://youtu.be/eixRIh80-F8
* "Learning Golang: Context package: Cancellations, Deadlines and Request-scoped values" https://youtu.be/mgJMIZsWfB4
== All Go/Golang video series covered
* Playlist "Learning Go": https://www.youtube.com/playlist?list=PL7yAAGMOat_F7bOImcjx4ZnCtfyNEqzCy
* Playlist "Software Architecture in Go": https://www.youtube.com/playlist?list=PL7yAAGMOat_GCd12Lrv_evJ3Zhv1dl8B-
* Playlist "Learning Go/Golang Concurrency Patterns" https://www.youtube.com/playlist?list=PL7yAAGMOat_Fhj_px_DzNzTsXs-mRwv1t
* Playlist "Building Microservices in Go": https://www.youtube.com/playlist?list=PL7yAAGMOat_Fn8sAXIk0WyBfK_sT1pohu
* Playlist "GoTools and Packages": https://www.youtube.com/playlist?list=PL7yAAGMOat_HEEOvH99agDs_5g51A0Ls3
* Playlist "Testing in Go": https://www.youtube.com/playlist?list=PL7yAAGMOat_HSeW4zF0uRL9EaHadE4ZZq
== Socials
* https://twitter.com/MarioCarrion
* https://www.instagram.com/mario.carrion
* https://linkedin.com/in/MarioCarrion
00:00 - Start
01:00 - Bulk Insert using database/sql via jackc/pgx (inefficient)
11:44 - Bulk Insert using jackc/pgx (efficient)
21:03 - Conclusions
---
Who am I:
Hello👋🏼! I'm Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.
Every week I will share with you different topics I've learned while working for small startups and large companies including the processes I've followed over the years for successfully delivering complex enterprise systems from start to end.
Subscribe if you like Software Development, Software Architecture and Systems Design!
Keep it up. Don't give up!
#golang #tutorial #databases
=== Our Vlog Channel
https://www.youtube.com/c/RubyCarrion/videos
=== Our affiliate links below
■ My Amazon Storefront: https://www.amazon.com/shop/rubycarrion
■ Shop my IG posts on my shopLTK page: https://www.shopltk.com/explore/RubyCarrion
■ Vlog camera: Sony RX100 VII https://amzn.to/3qQfvMc
■ Other vlog cameras and gear: https://rubycarrion.com/vlogcamerasandgear/
■ Shop through my links to support the channel: https://rubycarrion.com/shop-my-links/
■ Get a 30 day FREE Trial of Epidemic Sound: https://www.epidemicsound.com/referral/szx441/
■ Join Rakuten for FREE and get $30 when you spend $30: https://www.rakuten.com/r/RUBYRA132?eeid=28187
DISCLAIMER: Some of the links shared in the description are affiliate links. As a member of these affiliate programs, I earn a small commission from your purchases at no additional cost to you. I appreciate your support! 💖