<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-and-when-to-use-it-uls1etxg3" -->

---
title: How and when to use it | daily.dev
description: A practical walkthrough of the btree_gist PostgreSQL extension, which enables combined B-Tree and GiST indexes for queries spanning both one-dimensional data...
canonical: https://daily.dev/posts/how-and-when-to-use-it-uls1etxg3
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How and when to use it | daily.dev
og:description: A practical walkthrough of the btree_gist PostgreSQL extension, which enables combined B-Tree and GiST indexes for queries spanning both one-dimensional data...
og:url: https://daily.dev/posts/how-and-when-to-use-it-uls1etxg3
og:image: https://api.daily.dev/og/posts/uLs1eTxg3.png
og:image:alt: How and when to use it
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How and when to use it

**[Neon](https://daily.dev/sources/neontech)** · 6 min read · 0 upvotes · 0 comments

## Summary

A practical walkthrough of the btree_gist PostgreSQL extension, which enables combined B-Tree and GiST indexes for queries spanning both one-dimensional data (like dates) and multi-dimensional data (like spatial coordinates). Using UK crime data as a real-world example, the post demonstrates loading and spatially transforming the dataset, then compares query performance: unindexed (~8 seconds), spatial-only GiST index (~2 seconds), and a combined space-and-time btree_gist index (~8 milliseconds — nearly 1000x faster). The trade-off is increased disk usage (2.7GB vs 1.9GB for the spatial-only index).

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://neon.com/blog/btree_gist>

## Similar posts on daily.dev

- [Index types supported in Amazon Aurora PostgreSQL and Amazon RDS for PostgreSQL using extensions \(SP-GiST, Btree\_Gin and Btree\_Gist\)](https://daily.dev/posts/index-types-supported-in-amazon-aurora-postgresql-and-amazon-rds-for-postgresql-using-extensions-sp-crsoycppr) · AWS Database Blog · 0 upvotes · 0 comments
- [PostGIS Performance: Indexing and EXPLAIN](https://daily.dev/posts/postgis-performance-indexing-and-explain-fmb4tskgj) · Crunchy Data · 1 upvotes · 0 comments
- [Introduction to PostgreSQL Indexes ::](https://daily.dev/posts/introduction-to-postgresql-indexes--peasixbnz) · Hacker News · 0 upvotes · 0 comments
- [How Database Indexes Work – A Practical Guide with PostgreSQL Examples](https://daily.dev/posts/how-database-indexes-work-a-practical-guide-with-postgresql-examples-8anfbdgcl) · freeCodeCamp · 72 upvotes · 0 comments

---

Tags: [#postgresql](https://daily.dev/tags/postgresql), [#gis](https://daily.dev/tags/gis)

[View this post on daily.dev](https://daily.dev/posts/how-and-when-to-use-it-uls1etxg3)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How and when to use it","url":"https://daily.dev/posts/how-and-when-to-use-it-uls1etxg3","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-and-when-to-use-it-uls1etxg3"},"datePublished":"2026-07-09T06:57:48.285Z","dateModified":"2026-07-09T07:01:35.462Z","description":"A practical walkthrough of the btree_gist PostgreSQL extension, which enables combined B-Tree and GiST indexes for queries spanning both one-dimensional data...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5492544e482d46f5da56e87ee017f8b1?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5492544e482d46f5da56e87ee017f8b1?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Neon","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Neon","logo":"https://media.daily.dev/image/upload/s--65EDghou--/f_auto/v1724339118/logos/neontech","url":"https://daily.dev/sources/neontech"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-and-when-to-use-it-uls1etxg3","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"postgresql,gis","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Neon","item":"https://daily.dev/sources/neontech"},{"@type":"ListItem","position":3,"name":"How and when to use it"}]}
```

