Skip to content

Goroutine concurrency demo insert 1 million data with PostgreSQL, Gorm

Notifications You must be signed in to change notification settings

jeppung/goroutine-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Goroutine DB

Goroutine concurrency demo inserting 1.000.000 data with

  • Excelize (Reading excel data)
  • PostgreSQL (Database)
  • Gorm (ORM)

You are going to see how fast it takes to insert 1.000.000 data to database

Results

Goroutine Without Goroutine

!! Important !!

  • timer start after reading excel data
  • result may vary with different hardware specification

How to run

  • clone this repo
  • create postgres db named -> goroutine-db
  • rename .env.example -> .env
  • input your postgres db config in .env
    • example:
      • DB_HOST=localhost
      • DB_USER=postgres
      • DB_PASSWORD=postgres
      • DB_NAME=goroutine-db
      • DB_PORT=5432
  • go mod tidy
  • run code
    • Code with goroutine -> go run main.go
    • Code without goroutine -> go run single-worker/main.go

About

Goroutine concurrency demo insert 1 million data with PostgreSQL, Gorm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages