Skip to content

Instantly share code, notes, and snippets.

View bakink's full-sized avatar
🎯
Focusing

Baki Sahin bakink

🎯
Focusing
View GitHub Profile
@rschuman
rschuman / mongodb_performance_troubleshooting_guide.md
Last active October 8, 2024 06:02
MongoDB Performance Troubleshooting Guide
@anvk
anvk / psql_useful_stat_queries.sql
Last active June 1, 2025 16:17
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@travelliu
travelliu / dbdailychk.sh
Created December 13, 2015 14:31 — forked from haballan/dbdailychk.sh
Oracle Database Health Check Script
# ##############################################################################################
# DAILY HEALTH CHECK MONITORING SCRIPT
#
# =========================================================
# BECAUSE OF THE PERFORMANCE IMPACT THIS SCRIPT CAN CAUSE,
# I STRONGLY RECOMMEND TO SCHEDULE IT TO RUN IN NON PEAK HOURS
# E.G. SCHEDULE IT TO RUN ONE TIME BETWEEN 12:00AM to 5:00AM
# =========================================================
#
# FEATURES:
@Kartones
Kartones / postgres-cheatsheet.md
Last active October 10, 2025 19:12
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@niksumeiko
niksumeiko / git.migrate
Last active July 1, 2025 18:41
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active October 11, 2025 04:08
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@cheecheeo
cheecheeo / cassandra_maintainence.sh
Created June 8, 2012 18:45
Manual Cassandra compaction
#!/bin/bash
# Usage:
# ./cassandra_maintenance.sh
# or
# CASSANDRA_HOME=/path/to/cassandra ./cassandra_maintenance.sh
# Some useful logging commands:
#nodetool -h localhost compactionstats
#while true; do date | perl -pe 's/\n/ /g' >> /tmp/cassandra.log 2>&1 && nodetool -h localhost compactionstats >> /tmp/cassandra.log 2>&1 && sleep 10s; done &