-
Archives
- May 2026
- April 2026
- November 2025
- December 2024
- November 2024
- June 2024
- September 2023
- March 2023
- August 2022
- April 2022
- September 2021
- September 2020
- March 2019
- March 2018
- June 2017
- May 2017
- November 2016
- September 2016
- July 2016
- June 2016
- May 2016
- April 2016
- March 2016
- February 2016
- January 2016
- December 2015
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- April 2015
- December 2014
- October 2014
- September 2014
- May 2014
- April 2014
- March 2014
- January 2014
- November 2013
- October 2013
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
-
Meta
Author Archives: ronaldpringadi
Show postgres lock
You’re staring at a query that won’t finish, or a deploy that hangs on a migration, or a UI request that just sits there. Postgres is almost certainly waiting on a lock that another transaction holds. The classic query for … Continue reading
Posted in Database, PostgreSQL
Comments Off on Show postgres lock
Apache Lucene: The Search Engine Hiding Inside Half the Internet
If you’ve ever used Elasticsearch, Solr, or even some features in big platforms like Twitter or LinkedIn, chances are you’ve been touching Apache Lucene without knowing it. It’s the quiet workhorse — a Java library that does one thing extraordinarily … Continue reading
Check all table size in Postgres
You want a quick “which tables are eating my disk?” overview — usually before a vacuum, an archive purge, or a capacity-planning conversation. Here’s a one-shot query that joins information_schema.tables against pg_class to show every public table with its estimated … Continue reading
Posted in Database, PostgreSQL
Comments Off on Check all table size in Postgres
Synchronize a postgres table through bash and csv
Please note that the csv export process does not escape commas. 1234567891011121314151617181920212223242526272829303132333435#!/bin/bash DIR=’/root/sql_dump’ mkdir -p "$DIR" cd "$DIR" SIZE=100000 #START=611244350 START=0 END=$((START + SIZE)) STOP=189097000 TABLNAME="schema.tablename" while [[ $START -lt $STOP ]] && [[ $END -le $STOP ]]; do … Continue reading
Posted in Database, PostgreSQL
Comments Off on Synchronize a postgres table through bash and csv
Export and Import Postgres query to CSV
# =========================================================== # Export to CSV # =========================================================== # export PGPASSWORD=”YOURPASSWORD” # psql -U YOURUSERNAME -h YOURHOSTNAME -d YOURDBNAME-t -A -F”,” -c “select * from YOURTABLENAME limit 2″ > output.csv # =========================================================== # Import # =========================================================== # export PGPASSWORD=”YOURPASSWORD” # … Continue reading
Posted in Database, PostgreSQL
Comments Off on Export and Import Postgres query to CSV
Assorted postgres queries
Get table sizes: SELECT relname AS objectname, relkind AS objecttype, reltuples AS “#entries”, pg_size_pretty(relpages::bigint*8*1024) AS size FROM pg_class WHERE relpages >= 8 ORDER BY relpages DESC;
Posted in Database, PostgreSQL
Comments Off on Assorted postgres queries
RedHat or CentOS 6 iptables adding an open port
iptables –line -vnL iptables -I INPUT 5 -p tcp –dport 80 -m state –state NEW,ESTABLISHED -j ACCEPT service iptables save
Posted in Linux
Comments Off on RedHat or CentOS 6 iptables adding an open port
Postgres SSD optimization
If you’re running your database on an SSD instead of a spinning disk, you might want to optimize postgres table space cost: 12345678910– Change the tablespace cost ALTER TABLESPACE pg_default SET ( seq_page_cost = 20, random_page_cost = 1 ); — … Continue reading
Posted in Database, PostgreSQL
Comments Off on Postgres SSD optimization
Ant Junit debugging
Sometime we want to debug why ant build failed when executing a certain JUnit Make sure your ant junit task look like the following 1234<junit printsummary="withOutAndErr" haltonfailure="yes"> : : </junit> and not like 1234<junit printsummary="yes" haltonfailure="yes"> : : </junit>
Posted in java
Comments Off on Ant Junit debugging