A method comprising: a database management system receiving a policy (143A, 143B) to associate with a database object in a database, the policy (143A, 143B) specifying a custom function, defined by a user of the database, for triggering an archiving action on a stored representation of the database object, wherein at least a portion of the custom function is defined by the user of the database as program code in a language supported by the database, such as PL/SQL or Java, and wherein the database management system registers the custom function in the database in response to receiving user input from the user requesting to register the custom function; the database management system evaluating the custom function to a particular result, wherein the custom function utilizes an application programming interface, API, to retrieve access statistics associated with the database object, and wherein the custom function utilizes the retrieved access statistics; in response to evaluating the custom function to the particular result, the database management system performing the archiving action on the stored representation of the database object; wherein one of: (a) the access statistics associated with the database object include a segment level heatmap for segments within the database, wherein a segment comprises a set of one or more extents, an extent comprises one or more contiguous data blocks, and a block is the smallest unit of data a database server may request from a persistent storage device, and wherein said performing the archiving action on the stored representation of the database object is performed at segment granularity, or (b) the access statistics associated with the database object include a block level heatmap for database blocks within the database, wherein said performing the archiving action on the stored representation of the database object is performed at database block granularity; wherein the method is performed by one or more computing devices. a database management system receiving a policy (143A, 143B) to associate with a database object in a database, the policy (143A, 143B) specifying a custom function, defined by a user of the database, for triggering an archiving action on a stored representation of the database object, wherein at least a portion of the custom function is defined by the user of the database as program code in a language supported by the database, such as PL/SQL or Java, and wherein the database management system registers the custom function in the database in response to receiving user input from the user requesting to register the custom function; a database object in a database, the policy (143A, 143B) specifying a custom function, defined by a user of the database, for triggering an archiving action on a stored representation of the database object, wherein at least a portion of the custom function is defined by the user of the database as program code in a language supported by the database, such as PL/SQL or Java, and wherein the database management system registers the custom function in the database in response to receiving user input from the user requesting to register the custom function; the database management system evaluating the custom function to a particular result, wherein the custom function utilizes an application programming interface, API, to retrieve access statistics associated with the database object, and wherein the custom function utilizes the retrieved access statistics; particular result, wherein the custom function utilizes an application programming interface, API, to retrieve access statistics associated with the database object, and wherein the custom function utilizes the retrieved access statistics; in response to evaluating the custom function to the particular result, the database management system performing the archiving action on the stored representation of the database object; wherein one of: (a) the access statistics associated with the database object include a segment level heatmap for segments within the database, wherein a segment comprises a set of one or more extents, an extent comprises one or more contiguous data blocks, and a block is the smallest unit of data a database server may request from a persistent storage device, and wherein said performing the archiving action on the stored representation of the database object is performed at segment granularity, or (b) the access statistics associated with the database object include a block level heatmap for database blocks within the database, wherein said performing the archiving action on the stored representation of the database object is performed at database block granularity; (a) the access statistics associated with the database object include a segment level heatmap for segments within the database, wherein a segment comprises a set of one or more extents, an extent comprises one or more contiguous data blocks, and a block is the smallest unit of data a database server may request from a persistent storage device, and wherein said performing the archiving action on the stored representation of the database object is performed at segment granularity, or (b) the access statistics associated with the database object include a block level heatmap for database blocks within the database, wherein said performing the archiving action on the stored representation of the database object is performed at database block granularity; wherein the method is performed by one or more computing devices.