Task #1849
closedInvestigate using postgres materialized views for content views
0%
Description
postgres provides a special view type known as a materialized view, which creates a query-based view table whose contents is generated at query time.
http://www.postgresql.org/docs/current/static/sql-creatematerializedview.html
Our current content "view" is comprised of symlinks on a filesystem that are exposed via apache. Using materialized views, it may be possible to forego creating these symlinks in favor of using a materialized view that correlates request paths to "real" content unit locations on the filesystem for delivery. Assuming it's performant (and it should be), this could help eliminate the need to serve files out of /var/www.
As an example, when a request comes in for /repos/repo_id/content_unit, it could go through normal authorization, and then a db query to this view is made to come up with the correct value for X-Sendfile to give back to apache for serving up the content.
Thanks to Nicholas Strugnell for the suggestion.