Objects of this class allow to configure table partitioning based on time. By dividing a large
table into smaller partitions, you can improve query performance and reduce the number of bytes
billed by restricting the amount of data scanned.
See Also: Partitioned Tables
Returns the number of milliseconds for which to keep the storage for a partition. When expired,
the storage for the partition is reclaimed. If null, the partion does not expire.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Class TimePartitioning (2.54.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.54.1 (latest)](/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.TimePartitioning)\n- [2.54.0](/java/docs/reference/google-cloud-bigquery/2.54.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.53.0](/java/docs/reference/google-cloud-bigquery/2.53.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.52.0](/java/docs/reference/google-cloud-bigquery/2.52.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.51.0](/java/docs/reference/google-cloud-bigquery/2.51.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.50.1](/java/docs/reference/google-cloud-bigquery/2.50.1/com.google.cloud.bigquery.TimePartitioning)\n- [2.49.0](/java/docs/reference/google-cloud-bigquery/2.49.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.48.1](/java/docs/reference/google-cloud-bigquery/2.48.1/com.google.cloud.bigquery.TimePartitioning)\n- [2.47.0](/java/docs/reference/google-cloud-bigquery/2.47.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.46.0](/java/docs/reference/google-cloud-bigquery/2.46.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.45.0](/java/docs/reference/google-cloud-bigquery/2.45.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.44.0](/java/docs/reference/google-cloud-bigquery/2.44.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.43.3](/java/docs/reference/google-cloud-bigquery/2.43.3/com.google.cloud.bigquery.TimePartitioning)\n- [2.42.3](/java/docs/reference/google-cloud-bigquery/2.42.3/com.google.cloud.bigquery.TimePartitioning)\n- [2.41.0](/java/docs/reference/google-cloud-bigquery/2.41.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.40.3](/java/docs/reference/google-cloud-bigquery/2.40.3/com.google.cloud.bigquery.TimePartitioning)\n- [2.39.1](/java/docs/reference/google-cloud-bigquery/2.39.1/com.google.cloud.bigquery.TimePartitioning)\n- [2.38.2](/java/docs/reference/google-cloud-bigquery/2.38.2/com.google.cloud.bigquery.TimePartitioning)\n- [2.37.2](/java/docs/reference/google-cloud-bigquery/2.37.2/com.google.cloud.bigquery.TimePartitioning)\n- [2.36.0](/java/docs/reference/google-cloud-bigquery/2.36.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.35.0](/java/docs/reference/google-cloud-bigquery/2.35.0/com.google.cloud.bigquery.TimePartitioning)\n- [2.34.2](/java/docs/reference/google-cloud-bigquery/2.34.2/com.google.cloud.bigquery.TimePartitioning)\n- [2.33.2](/java/docs/reference/google-cloud-bigquery/2.33.2/com.google.cloud.bigquery.TimePartitioning) \n\n public abstract class TimePartitioning implements Serializable\n\nObjects of this class allow to configure table partitioning based on time. By dividing a large\ntable into smaller partitions, you can improve query performance and reduce the number of bytes\nbilled by restricting the amount of data scanned.\nSee Also: [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables) \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e TimePartitioning \n\nImplements\n----------\n\n[Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html) \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### newBuilder(TimePartitioning.Type type)\n\n public static TimePartitioning.Builder newBuilder(TimePartitioning.Type type)\n\nReturns a `TimePartitioning` object given the time partitioning type.\n\n### of(TimePartitioning.Type type)\n\n public static TimePartitioning of(TimePartitioning.Type type)\n\nReturns a `TimePartitioning` object given the time partitioning type. The partitions will\nnot expire.\n\n### of(TimePartitioning.Type type, long expirationMs)\n\n public static TimePartitioning of(TimePartitioning.Type type, long expirationMs)\n\nReturns a `TimePartitioning` object given the time partitioning type and the partition's\nexpiration in milliseconds.\n\nMethods\n-------\n\n### getExpirationMs()\n\n public abstract Long getExpirationMs()\n\nReturns the number of milliseconds for which to keep the storage for a partition. When expired,\nthe storage for the partition is reclaimed. If null, the partion does not expire.\n\n### getField()\n\n public abstract String getField()\n\n| **Beta**\n|\n| This feature is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.\n\nIf not set, the table is partitioned by pseudo column '_PARTITIONTIME'; if set, the table is\npartitioned by this field.\n\n### getRequirePartitionFilter()\n\n public abstract Boolean getRequirePartitionFilter()\n\n| **Beta**\n|\n| This feature is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.\n\nIf set to true, queries over this table require a partition filter (that can be used for\npartition elimination) to be specified.\n\n### getType()\n\n public abstract TimePartitioning.Type getType()\n\nReturns the time partitioning type.\n\n### toBuilder()\n\n public abstract TimePartitioning.Builder toBuilder()"]]