Sha256: 3fc701f134a8c875c50ed9881269667967a2dadccf7c8272d1e8bc9639ae81eb
Contents?: true
Size: 1.09 KB
Versions: 21
Compression:
Stored size: 1.09 KB
Contents
module Partitioned # # 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 ById < ByIntegerField self.abstract_class = true # # 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. # # @return [Boolean] true def self.prefetch_primary_key? return true end # # The number of records in each child table. # # @return [Integer] the number of rows in a partition def self.partition_table_size return 10000000 end # # The name of the field to partition on # # @return [String] the name of the field to partition on def self.partition_integer_field return :id end partitioned do |partition| partition.index :id, :unique => true end end end
Version data entries
21 entries across 21 versions & 1 rubygems