Class: Partitioned::ById
- Inherits:
-
ByIntegerField
- Object
- ActiveRecord::Base
- PartitionedBase
- ByIntegerField
- Partitioned::ById
- Defined in:
- lib/partitioned/by_id.rb
Overview
Table partitioning by id. this partitioning breaks up data by the value of its primary key. A specific record’s child table is determined by the number resulting from the integer math:
ID / ById::partition_table_size * ById::partition_table_size
Class Method Summary collapse
-
.partition_integer_field ⇒ String
The name of the field to partition on.
-
.partition_table_size ⇒ Integer
The number of records in each child table.
-
.prefetch_primary_key? ⇒ Boolean
Specific to this partitioning, we need to prefetch the primary key (id) before we attempt to do the insert because the insert wants to know the name of the specific child table to access.
Methods inherited from ByIntegerField
partition_generate_range, partition_normalize_key_value
Methods inherited from PartitionedBase
add_parent_table_rules, add_partition_table_index, add_references_to_partition_table, archive_old_partition, archive_old_partitions, arel_table_from_key_values, configurator, configurator_dsl, create_infrastructure, create_new_partition, create_new_partition_tables, create_new_partitions, create_partition_schema, create_partition_table, delete_infrastructure, drop_old_partition, drop_old_partitions, drop_partition_table, #dynamic_arel_table, dynamic_arel_table, from_partition, from_partition_without_alias, partition_generate_range, partition_key_values, partition_keys, partition_manager, partition_name, partition_normalize_key_value, partition_table_alias_name, #partition_table_name, partition_table_name, partitioned, sql_adapter
Methods included from ActiveRecordOverrides
#arel_attributes_values, #delete
Class Method Details
.partition_integer_field ⇒ String
The name of the field to partition on
33 34 35 |
# File 'lib/partitioned/by_id.rb', line 33 def self.partition_integer_field return :id end |
.partition_table_size ⇒ Integer
The number of records in each child table.
25 26 27 |
# File 'lib/partitioned/by_id.rb', line 25 def self.partition_table_size return 10000000 end |
.prefetch_primary_key? ⇒ Boolean
Specific to this partitioning, we need to prefetch the primary key (id) before we attempt to do the insert because the insert wants to know the name of the specific child table to access.
17 18 19 |
# File 'lib/partitioned/by_id.rb', line 17 def self.prefetch_primary_key? return true end |