mephi-databases

module
v0.0.0-...-0372559 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: MIT

README

mephi-databases

Laboratory work on the database course at MEPhI.
Topic: Trello

This project is built in Go, uses GORM as an ORM for PostgreSQL and gofakeit package to seed the database.

Checkout the queries.md file for possible queries to run.

Entity-relationship diagram

Run

The project is dockerized. To run it, you need to have Docker installed on your machine.
If you want to run seeder, you need to pass --profile seed to the docker-compose command.

docker compose --profile seed up --build

After the seeder has finished its work, you can run the project without the --profile seed flag, because the database will already be populated.

docker-compose up --build
Configuration

Projects's configuration is stored in the config.yml file.
Default configuration:

seeder:
  load_batch_size: 2000
  create_batch_size: 5000
  entities: # Number of entities to create
    users: 10000
    # Average ratios of entities
    # Notice that labels and board members are the most numerous entities (30 times more than users)
    # Overall, the number of entities is 161 times more than the number of users
    # For example, if you have 10.000 users, you will have 1.610.000 entities in total
    boards_per_user: 3 # 3x users
    lists_per_board: 3 # 9x users
    cards_per_list: 2 # 18x users
    labels_per_board: 10 # 30x users
    comments_per_card: 0.5 # 9x users
    attachments_per_card: 0.333 # 6x users
    board_members_per_board: 10 # 30x users
    card_labels_per_card: 1.5 # 27x users
    card_assignees_per_card: 1.5 # 27x users
Benchmark

On my machine (M1Pro MBP 14"), the seeder creates 10k users and 16.1M entities in roughly 40 seconds (with the default configuration).
pgdata volume is about 2.7GB.

PgAdmin

PgAdmin will be available at http://localhost:5050.

Credentials to connect to the database:

Host name/address: database
Port: 5432
Username: mephi
Password: mephi

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL