Posts

Showing posts with the label unbalanced trees

SP-GiST Index

Image
Introduction SP-GiST (Space-Partitioned Generalized Search Tree) operates based on the core idea of space partitioning, applied to complex data such as geographical coordinates (longitude, latitude), long text strings or hierarchical structures (directories). Index Creation SP-GiST Index has key characteristics including: Non-overlapping space partitioning: When it divides space (or the dataset) into smaller parts, these parts do not overlap. A data point can only belong to branch A or branch B, not both. Unbalanced Trees: Unlike B-Tree which is always balanced between branches, SP-GiST allows branches to grow freely. Whichever branch has more complex data will be more detailed, while branches with less data stop early. This helps save memory effectively. For example, when there is a search keyword list consisting of: sam , sample , samsung , samurai and apple . If using B-Tree Index, it will store these exact words If using GIN Index, it will break down each word before storing If us...