Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.

jamespepplinkhouse/postgres-large-files-prototype

Repository files navigation

postgres-large-files-prototype

Why?

This code will test various scenarios of uploading and downloading files from Postgres Large File Storage. In production we have seen that poor network conditions can interrupt an upload or download leaving transactions open which eventually will queue and lock any further transactions.

We want battle hardened Node.js code that will clean up transactions so that the server can survive these conditions!

Useful SQL Queries for Postgres

Find open transaction locks

SELECT * FROM pg_locks pl
LEFT JOIN pg_stat_activity psa
ON pl.pid = psa.pid
WHERE application_name != 'pgAdmin III - Query Tool';

Kill a transaction

select pg_terminate_backend(18234);

Download a file

$ psql --host localhost -U postgres -d media -p 5444 -c "\lo_export 17531 '~/Desktop/download.test' "

List large objects

$ psql --host localhost -U postgres -d media -p 5444 -c "\lo_list"

About

Test postgres LFS transactions under load and bad conditions from Node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published