Notes
  • Overview
  • Go
    • Basics
    • How To?
    • Tools & Libraries
    • Tutorials
    • Go Modules
    • Design Patterns
    • Guidelines
      • Code Review and Comments
    • Conversion
      • map[string]interface{} to JSON
      • map[string]interface{} to struct
    • Tips & Tricks
  • Docker
    • Blog Posts
    • Commands
  • Kubernetes
    • Courses
    • Concepts
    • Networking
      • Ingress Controller
    • KIND
    • Custom Resources
    • Tips & Tricks
      • Commands
        • Log
        • List
      • Container
        • Inject Executable Script
      • RBAC
        • Cross namespaced access
      • Patching Object
        • Restrict Key
      • Copy Object
  • Git
    • Rebase
  • System Design
    • Pub-Sub
      • Ovserver vs PubSub
  • Distributed System
    • Untitled
  • Linux
    • Bash
      • Basics
      • How To?
      • Pipe
      • Tips & Tricks
  • Security
    • Untitled
  • Database
    • PostgreSQL
      • Tricks & Tips
    • MySQL
      • Tips & Tricks
  • MISC
    • Development Patterns
    • Useful Github Apps/Actions
    • Parameters vs Arguments
    • Open API
  • Terminal
  • VS Code
Powered by GitBook
On this page
  • Generating Sample Data
  • View Database & table Size

Was this helpful?

  1. Database
  2. PostgreSQL

Tricks & Tips

Generating Sample Data

CREATE TABLE large_test (num1 bigint, num2 double precision, num3 double precision);
INSERT INTO large_test (num1, num2, num3) SELECT round(random()*10), random(), random()*142 FROM generate_series(1, 2000000) s(i);

View Database & table Size

# all databases size
\l+
# specific database size
\l+ <database_name>
# all table size
\d+
# specific table size
\d+ <table_name>
PreviousPostgreSQLNextMySQL

Last updated 4 years ago

Was this helpful?