ESTRATEGIAS DE INDEXACIÓN EN POSTGRESQL PARA BÚSQUEDA TEXTUAL Y SEMÁNTICA: UN ESTUDIO EXPERIMENTAL SOBRE UN ACERVO JURÍDICO PARCIALMENTE VECTORIZADO
DOI:
https://doi.org/10.56238/arev8n11-071Palabras clave:
PostgreSQL, Estrategias de Indexación, Búsqueda Textual, Búsqueda Semántica, Recuperación de la InformaciónResumen
Este estudio comparó experimentalmente estrategias de indexación de PostgreSQL para búsqueda textual y semántica en un escenario de adopción incremental de embeddings. Se evaluaron los índices GIN y GiST sobre la representación tsvector, el índice GIN de trigramas de la extensión pg_trgm y el índice IVFFlat de la extensión pgvector, todos aplicados al mismo corpus, a la misma infraestructura y al mismo conjunto de consultas. El corpus reunió 67.755 decisiones completas del Superior Tribunal de Justicia de Brasil, de las cuales 9.994 (14,75%) fueron convertidas en vectores de 384 dimensiones mediante un modelo multilingüe de código abierto ejecutado localmente. El enfoque fue cuantitativo y experimental, midiendo el tiempo de construcción, el espacio ocupado en disco, el tiempo de respuesta de las consultas y los planes de ejecución. Los resultados indicaron que, en la búsqueda textual, GIN y GiST presentaron tiempos de consulta prácticamente equivalentes, pero GiST se construyó en cerca de un tercio del tiempo de GIN y ocupó aproximadamente seis veces menos espacio en disco. La búsqueda por trigramas concentró los mayores costos, mientras que IVFFlat presentó bajo costo de construcción y respuesta rápida, con la salvedad de la cobertura vectorial parcial. También se constató la inviabilidad del índice GiST de trigramas sobre documentos extensos, debido al límite de 8.191 bytes por fila de índice. Se concluye que la elección de la estrategia depende del equilibrio entre rendimiento de consulta, costo de construcción, almacenamiento y calidad de la recuperación, y se proponen directrices para apoyar la transición de la búsqueda léxica a la semántica.
Descargas
Referencias
ARMBRUST, Michael et al. A view of cloud computing. Communications of the ACM, New York, v. 53, n. 4, p. 50-58, 2010. DOI: https://doi.org/10.1145/1721654.1721672
BAEZA-YATES, Ricardo; RIBEIRO-NETO, Berthier. Modern information retrieval: the concepts and technology behind search. 2. ed. Harlow: Pearson Education, 2011.
BARTUNOV, Oleg; SIGAEV, Teodor. Improvement of Generalized Inverted Index (GIN). In: PGCON, 2008, Ottawa. Ottawa: PGCon, 2008.
BAYER, Rudolf; McCREIGHT, Edward M. Organization and maintenance of large ordered indexes. Acta Informatica, [s. l.], v. 1, n. 3, p. 173-189, 1972. DOI: https://doi.org/10.1007/BF00288683
CHEN, Jinchuan et al. Big data challenge: a data management perspective. Frontiers of Computer Science, [s. l.], v. 7, n. 2, p. 157-164, 2013. DOI: https://doi.org/10.1007/s11704-013-3903-7
CODD, Edgar Frank. A relational model of data for large shared data banks. Communications of the ACM, New York, v. 13, n. 6, p. 377-387, 1970. DOI: https://doi.org/10.1145/362384.362685
CRESWELL, John W. Projeto de pesquisa: métodos qualitativo, quantitativo e misto. 3. ed. Porto Alegre: Artmed, 2010.
ELMASRI, Ramez; NAVATHE, Shamkant B. Fundamentals of database systems. 7. ed. Boston: Pearson, 2016.
GIL, Antônio Carlos. Como elaborar projetos de pesquisa. 6. ed. São Paulo: Atlas, 2017.
GRAEFE, Goetz. Modern B-tree techniques. Foundations and Trends in Databases, Hanover, v. 3, n. 4, p. 203-402, 2011. DOI: https://doi.org/10.1561/1900000028
GUTTMAN, Antonin. R-trees: a dynamic index structure for spatial searching. In: ACM SIGMOD INTERNATIONAL CONFERENCE ON MANAGEMENT OF DATA, 1984, Boston. Proceedings [...]. New York: ACM Press, 1984. p. 47-57. DOI: https://doi.org/10.1145/602259.602266
HELLERSTEIN, Joseph M.; NAUGHTON, Jeffrey F.; PFEFFER, Avi. Generalized search trees for database systems. In: INTERNATIONAL CONFERENCE ON VERY LARGE DATA BASES, 21., 1995, Zurich. Proceedings [...]. Zurich: Morgan Kaufmann, 1995. p. 562-573.
JOHNSON, Jeff; DOUZE, Matthijs; JÉGOU, Hervé. Billion-scale similarity search with GPUs. IEEE Transactions on Big Data, New York, v. 7, n. 3, p. 535-547, 2021. DOI: https://doi.org/10.1109/TBDATA.2019.2921572
KAVULURI, Harsha Vardhan Reddy. Serverless databases: future trends in cloud database management and cost optimization. Archives for Technical Sciences, Bijeljina, v. 33, n. 2, p. 307-321, 2025. DOI: https://doi.org/10.70102/afts.2025.1833.307
LEWIS, Patrick et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. In: ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS, 33., 2020. Proceedings [...]. [S. l.]: Curran Associates, 2020.
LIU, Jiayi; GUO, Te; WANG, Jianguo. Building an integrated vector database system in PostgreSQL. arXiv, [s. l.], 2026.
MALKOV, Yu. A.; YASHUNIN, D. A. Efficient and robust approximate nearest neighbor search using hierarchical navigable small world graphs. IEEE Transactions on Pattern Analysis and Machine Intelligence, New York, v. 42, n. 4, p. 824-836, 2020. DOI: https://doi.org/10.1109/TPAMI.2018.2889473
MANNING, Christopher D.; RAGHAVAN, Prabhakar; SCHÜTZE, Hinrich. Introduction to information retrieval. Cambridge: Cambridge University Press, 2008. DOI: https://doi.org/10.1017/CBO9780511809071
MIKOLOV, Tomas et al. Efficient estimation of word representations in vector space. In: INTERNATIONAL CONFERENCE ON LEARNING REPRESENTATIONS, 1., 2013, Scottsdale. Proceedings [...]. [S. l.: s. n.], 2013.
MOMJIAN, Bruce. PostgreSQL: introduction and concepts. Boston: Addison-Wesley, 2001.
PIBIRI, Giulio Ermanno; VENTURINI, Rossano. Techniques for inverted index compression. ACM Computing Surveys, New York, v. 53, n. 6, p. 1-36, 2020. DOI: https://doi.org/10.1145/3415148
PORTER, Martin F. An algorithm for suffix stripping. Program, Bingley, v. 14, n. 3, p. 130-137, 1980. DOI: https://doi.org/10.1108/eb046814
POSTGRESQL GLOBAL DEVELOPMENT GROUP. pgvector: open-source vector similarity search for Postgres. GitHub, 2026. Disponível em: https://github.com/pgvector/pgvector. Acesso em: 25 mar. 2026.
POSTGRESQL GLOBAL DEVELOPMENT GROUP. PostgreSQL documentation. [S. l.], 2025. Disponível em: https://www.postgresql.org/docs/. Acesso em: 30 mar. 2026.
STONEBRAKER, Michael; ROWE, Lawrence A. The design of POSTGRES. ACM SIGMOD Record, New York, v. 15, n. 2, p. 340-355, 1986. DOI: https://doi.org/10.1145/16856.16888
TOKTOMUSHEVA, Gulkaiyr. Indexing in PostgreSQL: performance evaluation and use cases. Preprints.org, [s. l.], 2025. DOI: https://doi.org/10.20944/preprints202511.2170.v1