{"id":20271014,"url":"https://github.com/postgres-ai/postgres-howtos","last_synced_at":"2026-01-28T15:30:56.575Z","repository":{"id":206723571,"uuid":"699932915","full_name":"postgres-ai/postgres-howtos","owner":"postgres-ai","description":"Postgres HowTo articles","archived":false,"fork":false,"pushed_at":"2024-10-31T03:16:35.000Z","size":30693,"stargazers_count":133,"open_issues_count":0,"forks_count":11,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-11T00:01:39.585Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postgres-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-03T16:09:18.000Z","updated_at":"2025-03-08T16:02:45.000Z","dependencies_parsed_at":"2024-10-31T04:28:41.569Z","dependency_job_id":null,"html_url":"https://github.com/postgres-ai/postgres-howtos","commit_stats":null,"previous_names":["postgres-ai/postgres-howtos"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/postgres-ai/postgres-howtos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgres-ai%2Fpostgres-howtos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgres-ai%2Fpostgres-howtos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgres-ai%2Fpostgres-howtos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgres-ai%2Fpostgres-howtos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postgres-ai","download_url":"https://codeload.github.com/postgres-ai/postgres-howtos/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgres-ai%2Fpostgres-howtos/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28846338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T12:35:42.481Z","updated_at":"2026-01-28T15:30:56.551Z","avatar_url":"https://github.com/postgres-ai.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"This project has been started by @NikolayS on 2023-09-26 https://twitter.com/samokhvalov/status/1706748070967624174:\n\n\u003e I'm going to start a PostgreSQL marathon: each day I'll be posting a new \"howto\" recipe. Today is the day zero, and the first post is here.\n\n\u003e My goal is to create at least 365 posts 😎\n\n\u003e Why am I doing it?\n\u003e 1. Postgres docs are awesome but often lack practical pieces of advice (howtos)\n\u003e 2. 20+ years of database experience, from small startups to giants like Chewy, GitLab, Miro - always have a feeling that I need to share\n\u003e 3. eventually I aim to have a structured set of howtos, constantly improving it - and make the systems we develop at [Postgres.ai](https://Postgres.ai) / [Database_Lab](https://twitter.com/Database_Lab) better and more helpful.\n\n[Subscribe](https://twitter.com/samokhvalov/status/1706748070967624174), like, share, and wish me luck with this -- and let's go! 🏊\n\n## GPT\n\n2024-01-10 OpenAI launched GPT Store, so there is now GPT called `#PostgresMarathon` available there: https://chat.openai.com/g/g-ZmfkdmXzD-postgresmarathon – feel free to use it, it contains all the knowledge from here.\n\n## ToC\n\u003c!-- To build it using LLM, use this prompt:\n\"\"\"\nI want to build ToC for these files in Git. help.\nNotice the numbers in the beginning 0001, 0002, etc.\nDon't provide any additional comments – I need just the data to insert to README.\nFormat the response as markdown.\n\n{{ and here provide the output of:  `grep \"^ *# \" *.md` }}\n\nAs an example, first 2 rows:\n- 0001 [`EXPLAIN ANALYZE` or `EXPLAIN (ANALYZE, BUFFERS)`?](./0001_explain_analyze_buffers.md)\n- 0002 [How to troubleshoot and speed up Postgres stop and restart attempts](./0002_how_to_troubleshoot_and_speedup_postgres_restarts.md)\n\"\"\"\n--\u003e\n\n- 0001 [`EXPLAIN ANALYZE` or `EXPLAIN (ANALYZE, BUFFERS)`?](./0001_explain_analyze_buffers.md)\n- 0002 [How to troubleshoot and speed up Postgres stop and restart attempts](./0002_how_to_troubleshoot_and_speedup_postgres_restarts.md)\n- 0003 [How to troubleshoot long Postgres startup](./0003_how_to_troubleshoot_long_startup.md)\n- 0004 [Understanding how sparsely tuples are stored in a table](./0004_tuple_sparsenes.md)\n- 0005 [How to work with pg_stat_statments, part 1](./0005_pg_stat_statements_part_1.md)\n- 0006 [How to work with pg_stat_statements, part 2](./0006_pg_stat_statements_part_2.md)\n- 0007 [How to work with pg_stat_statements, part 3](./0007_pg_stat_statements_part_3.md)\n- 0008 [How to speed up pg_dump when dumping large databases](./0008_how_to_speed_up_pg_dump.md)\n- 0009 [How to understand LSN values and WAL filenames](./0009_lsn_values_and_wal_filenames.md)\n- 0010 [How to troubleshoot Postgres performance using FlameGraphs and eBPF (or perf)](./0010_flamegraphs_for_postgres.md)\n- 0011 [Ad-hoc monitoring](./0011_ad_hoc_monitoring.md)\n- 0012 [How to find query examples for problematic pg_stat_statements records](./0012_from_pgss_to_explain__how_to_find_query_examples.md)\n- 0013 [How to benchmark](./0013_how_to_benchmark.md)\n- 0014 [How to decide when query is too slow and needs optimization](./0014_how_to_decide_if_query_too_slow.md)\n- 0015 [How to monitor CREATE INDEX / REINDEX progress in Postgres 12+](./0015_how_to_monitor_index_operations.md)\n- 0016 [How to get into trouble using some Postgres features](./0016_how_to_get_into_trouble_using_some_postgres_features.md)\n- 0017 [How to determine the replication lag](./0017_how_to_determine_the_replication_lag.md)\n- 0018 [Over-indexing](./0018_over_indexing.md)\n- 0019 [How to import CSV to Postgres](./0019_how_to_import_csv_to_postgres.md)\n- 0020 [How to use pg_restore](./0020_how_to_use_pg_restore.md)\n- 0021 [How to set application_name without extra queries](./0021_how_to_set_application_name_without_extra_queries.md)\n- 0022 [How to analyze heavyweight locks, part 1](./0022_how_to_analyze_heavyweight_locks_part_1.md)\n- 0023 [How to use OpenAI APIs right from Postgres to implement semantic search and GPT chat](./0023_how_to_use_openai_apis_in_postgres.md)\n- 0024 [How to work with metadata](./0024_how_to_work_with_metadata.md)\n- 0025 [How to quit from psql](./0025_how_to_quit_from_psql.md)\n- 0026 [How to check btree indexes for corruption](./0026_how_to_check_btree_indexes_for_corruption.md)\n- 0027 [How to compile Postgres on Ubuntu 22.04](./0027_how_to_compile_postgres_on_ubuntu_22.04.md)\n- 0028 [How to work with arrays, part 1](./0028_how_to_work_with_arrays_part_1.md)\n- 0029 [How to work with arrays, part 2](./0029_how_to_work_with_arrays_part_2.md)\n- 0030 [How to deal with long-running transactions (OLTP)](./0030_how_to_deal_with_long-running_transactions_oltp.md)\n- 0031 [How to troubleshoot a growing pg_wal directory](./0031_how_to_troubleshoot_a_growing_pg_wal_directory.md)\n- 0032 [How to speed up bulk load](./0032_how_to_speed_up_bulk_load.md)\n- 0033 [How to redefine a PK without downtime](./0033_how_to_redefine_a_PK_without_downtime.md)\n- 0034 [How to perform initial / rough Postgres tuning](./0034_how_to_perform_postgres_tuning.md)\n- 0035 [How to use subtransactions in Postgres](./0035_how_to_use_subtransactions_in_postgres.md)\n- 0036 [\"Find-or-insert\" using a single query](./0036_find-or-insert_using_a_single_query.md)\n- 0037 [How to enable data checksums without downtime](./0037_how_to_enable_data_checksums_without_downtime.md)\n- 0038 [How to NOT get screwed as a DBA (DBRE)](./0038_how_to_not_get_screwed_as_a_dba.md)\n- 0039 [How to break a database, Part 1: How to corrupt](./0039_how_to_break_a_database_part_1_how_to_corrupt.md)\n- 0040 [How to break a database, Part 2: Simulate infamous transaction ID wraparound](./0040_how_to_break_a_database_part_2_simulate_xid_wraparound.md)\n- 0041 [How to break a database, Part 3: Harmful workloads](./0041_harmful_workloads.md)\n- 0042 [How to analyze heavyweight locks, part 2: Lock trees (a.k.a. \"lock queues\", \"wait queues\", \"blocking chains\")](./0042_how_to_analyze_heavyweight_locks_part_2.md)\n- 0043 [How to format SQL (SQL style guide)](./0043_how_to_format_sql.md)\n- 0044 [How to monitor transaction ID wraparound risks](./0044_how_to_monitor_transaction_id_wraparound_risks.md)\n- 0045 [How to monitor xmin horizon to prevent XID/MultiXID wraparound and high bloat](./0045_how_to_monitor_xmin_horizon.md)\n- 0046 [How to deal with bloat](./0046_how_to_deal_with_bloat.md)\n- 0047 [How to install Postgres 16 with plpython3u: Recipes for macOS, Ubuntu, Debian, CentOS, Docker](./0047_how_to_install_postgres_16_with_plpython3u.md)\n- 0048 [How to generate fake data](./0048_how_to_generate_fake_data.md)\n- 0049 [How to use variables in psql scripts](./0049_how_to_use_variables_in_psql_scripts.md)\n- 0050 [Pre- and post-steps for benchmark iterations](./0050_pre_and_post_steps_for_benchmark_iterations.md)\n- 0051 [Learn how to work with schema metadata by spying after psql](./0051_learn_about_schema_metadata_via_psql.md)\n- 0052 [How to reduce WAL generation rates](./0052_how_to_reduce_wal_generation_rates.md)\n- 0053 [Index maintenance](./0053_index_maintenance.md)\n- 0054 [How to check btree indexes for corruption (pg_amcheck)](./0054_how_to_check_btree_indexes_for_corruption.md)\n- 0055 [How to drop a column](./0055_how_to_drop_a_column.md)\n- 0056 [How to make the non-production Postgres planner behave like in production](./0056_how_to_imitate_production_planner.md)\n- 0057 [How to convert a physical replica to logical](./0057_how_to_convert_a_physical_replica_to_logical.md)\n- 0058 [How to use Docker to run Postgres](./0058_how_to_use_docker_to_run_postgres.md)\n- 0059 [psql tuning](./0059_psql_tuning.md)\n- 0060 [How to add a column](./0060_how_to_add_a_column.md)\n- 0061 [How to create an index, part 1](./0061_how_to_create_an_index_part_1.md)\n- 0062 [How to create an index, part 2](./0062_how_to_create_an_index_part_2.md)\n- 0063 [How to help others](./0063_how_to_help_others.md)\n- 0064 [How to use UUID](./0064_how_to_use_uuid.md)\n- 0065 [UUID v7 and partitioning (TimescaleDB)](./0065_uuid_v7_and_partitioning_timescaledb.md)\n- 0066 [How many tuples can be inserted in a page](./0066_how_many_tuples_can_be_inserted_in_a_page.md)\n- 0067 [Autovacuum \"queue\" and progress](./0067_autovacuum_queue_and_progress.md)\n- 0068 [psql shortcuts](./0068_psql_shortcuts.md)\n- 0069 [How to add a CHECK constraint without downtime](./0069_howd_tod_addd_ad_checkd_constraintd_withoutd_downtime.md)\n- 0070 [How to add a foreign key](./0070_how_to_add_a_foreign_key.md)\n- 0071 [How to understand what's blocking DDL](./0071_how_to_understand_what_is_blocking_ddl.md)\n- 0072 [How to remove a foreign key](./0072_how_to_remove_a_foreign_key.md)\n- 0073 [How to analyze heavyweight locks, part 3. Persistent monitoring](./0073_how_to_analyze_heavyweight_locks_part_3_persistent_monitoring.md)\n- 0074 [How to flush caches (OS page cache and Postgres buffer pool)](./0074_how_to_flush_caches.md)\n- 0075 [How to find redundant indexes](./0076_how_to_find_redundent_indexes)\n- 0076 [How to find unused indexes](./0076_how_to_find_redundent_indexes.md)\n- 0077 [Postgres major upgrade without any downtime for a very large cluster running under heavy load](./0077_zero_downtime_major_upgrade.md)\n- 0078 [How to estimate the YoY growth of a very large table using row creation timestamps and the planner statistics](./0078_estimate_yoy_table_growth.md)\n- 0079 [How to rebuild many indexes using many backends avoiding deadlocks](./0079_rebuild_indexes_without_deadlocks.md)\n- 0080 [How to find int4 PKs with out-of-range risks in a large database](./0080_how_to_find_int4_pks_with_out_of_range_risks.md)\n- 0081 [How to plot graphs right in psql on macOS (iTerm2)](./0081_how_to_plot_graphs_right_in_psql_on_macos_iterm2.md)\n- 0082 [How to draw frost patterns using SQL ❄️](./0082_how_to_draw_frost_patterns_using_sql.md)\n- 0083 [How to quickly check data type and storage size of a value](./0083_how_to_quickly_check_data_type_and_storage_size_of_a_value.md)\n- 0084 [How to find the best order of columns to save on storage (\"Column Tetris\")](./0084_how_to_find_the_best_order_of_columns_to_save_on_storage.md)\n- 0085 [How to quickly check data type and storage size of a value](./0085_how_to_quickly_check_data_type_and_storage_size_of_a_value.md)\n- 0086 [How to make \"\\e\" work in psql on a new machine (\"editor/nano/vi not found\")](./0086_how_to_make_e_work_in_psql.md)\n- 0087 [How to change ownership of all objects in a database](./0087_how_to_change_ownership_of_all_objects_in_a_database.md)\n- 0088 [How to tune Linux parameters for OLTP Postgres](./0088_how_to_tune_linux_parameters_for_oltp_postgres.md)\n- 0089 [Rough configuration tuning (80/20 rule; OLTP)](./0089_rough_oltp_configuration_tuning.md)\n- 0090 [How to use lib_pgquery in shell to normalize and match queries from various sources](./0090_how_to_use_lib_pgquery_in_shell.md)\n- 0091 [How to format text output in psql scripts](./0091_how_to_format_text_output_in_psql_scripts.md)\n- 0092 [How to tune work_mem](./0092_how_to_tune_work_mem.md)\n- ...\n\n## Contributors (thanks!!)\n\n- Tweets converted to markdown by @msdousti \n- Corrections by @borisz1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgres-ai%2Fpostgres-howtos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostgres-ai%2Fpostgres-howtos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgres-ai%2Fpostgres-howtos/lists"}