Use of large databases in scientific research has increased to the point where scientists can test hypotheses, perform research, and make original discoveries entirely within the database. Several projects in medicine, biology, biochemistry, physics and astronomy provide very large repositories (multi-terabyte) of raw data for other scientists to then carry out experiments ``inside'' the database. The Sloan Digital Sky Survey``SkyServer'' is one example of this, with 14TB of image data and spectroscopic analyses freely available for access by any internet user. Many of these projects, as a matter of principle, offer extremely liberal access policies: SkyServer, for example, accepts and executes arbitrary SQL queries from any remote user without authentication. The only constraints are some fairly generous runtime timeouts, where queries are abandoned after 10min--1hr if they have not completed. We outline one possible contribution of programming language technology to managing resource and availability issues in this model: specifically, a type and effect system for a nested relational query language that provides asymptotic complexity bounds for query execution time and result size. The goal is that such bounds can form the basis of useful feedback to users about potentially expensive queries, as well as a portable and transparent policy language for resource management in globally-accessible scientific databases. This talk describes work done at the University of Edinburgh in collaboration with James Cheney and Kenneth MacKenzie.