archive or partition workaround-VBForums
Results 1 to 7 of 7

Thread: archive or partition workaround

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Location
    San Isidro
    Posts
    326

    archive or partition workaround

    can you please help me how to make an archive or partition workaround for my million of records? will it make my system faster if i will partition or archive my mysql database?
    I want to learn more
    grace

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Location
    San Isidro
    Posts
    326

    Re: archive or partition workaround

    help me please..
    I want to learn more
    grace

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Location
    San Isidro
    Posts
    326

    Re: archive or partition workaround

    hello Please anyone who could help me?
    I want to learn more
    grace

  4. #4
    PowerPoster
    Join Date
    May 2002
    Posts
    25,524

    Re: archive or partition workaround

    That may or may not be the answer... you also posted in a bad place for a database questions (I'll ask the mods to move it).

    If you could explain a little bit about your data and what you have already done to improve performance, maybe someone can either suggest something else, or if it's already where it should be and it's still performing bad, then look at partitioning.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    Addicted Member Pc Monk's Avatar
    Join Date
    Feb 2010
    Posts
    150

    Re: archive or partition workaround

    What is Partitioning?

    Partitioning is a physical database design technique that many data modelers and DBAs are quite familiar with. Although partitioning can be used to accomplish a number of various objectives, the main goal is to reduce the amount of data read for particular SQL operations so that overall response time is reduced.

    There are two major forms of partitioning:

    Horizontal Partitioning – this form of partitioning segments table rows so that distinct groups of physical row-based datasets are formed that can be addressed individually (one partition) or collectively (one-to-all partitions). All columns defined to a table are found in each set of partitions so no actual table attributes are missing. An example of horizontal partitioning might be a table that contains ten years worth of historical invoice data being partitioned into ten distinct partitions, where each partition contains a single year's worth of data.

    Vertical Partitioning – this partitioning scheme is traditionally used to reduce the width of a target table by splitting a table vertically so that only certain columns are included in a particular dataset, with each partition including all rows. An example of vertical partitioning might be a table that contains a number of very wide text or BLOB columns that aren't addressed often being broken into two tables that has the most referenced columns in one table and the seldom-referenced text or BLOB data in another.

    Before database vendors began building partitioning (mainly horizontal) into their engines, DBAs and data modelers had to physically design separate table structures to hold the desired partitions, which either held redundant data (separate tables with data that were based off a live parent table) or were linked together to form one logical parent object (usually via a view). This practice has since been made obsolete for the most part for horizontal partitioning, although it is sometimes still done for vertical partitioning.
    Partitioning in MySQL 5.1

    One of the great new features in MySQL 5.1 is support for horizontal partitioning. The really good news about MySQL and the new 5.1 partitioning feature is all the major forms of partitioning are supported:

    Range – this partitioning mode allows a DBA to specify various ranges for which data is assigned. For example, a DBA may create a partitioned table that is segmented by three partitions that contain data for the 1980's, 1990's, and everything beyond and including the year 2000.

    Hash – this partitioning mode allows a DBA to separate data based on a computed hash key that is defined on one or more table columns, with the end goal being an equal distribution of values among partitions. For example, a DBA may create a partitioned table that has ten partitions that are based on the table's primary key.

    Key – a special form of Hash where MySQL guarantees even distribution of data through a system-generated hash key.

    List – this partitioning mode allows a DBA to segment data based on a pre-defined list of values that the DBA specifies. For example, a DBA may create a partitioned table that contains three partitions based on the years 2004, 2005, and 2006.

    Composite – this final partitioning mode allows a DBA to perform sub-partitioning where a table is initially partitioned by, for example range partitioning, but then each partition is segmented even further by another method (for example, hash).

    Partitioning in Action

    To see the positive benefit partitioning can have on a database, let's create identical MyISAM tables that contain date sensitive information, For our partitioned table, we'll partition based on range and use a function that segments the data based on year:

    Code:
    mysql> CREATE TABLE part_tab
        ->      (  c1 int default NULL,
        ->  c2 varchar(30) default NULL,
        ->  c3 date default NULL
        ->
        ->      ) engine=myisam 
        ->      PARTITION BY RANGE (year(c3)) (PARTITION p0 VALUES LESS THAN (1995),
        ->      PARTITION p1 VALUES LESS THAN (1996) , PARTITION p2 VALUES LESS THAN (1997) ,
        ->      PARTITION p3 VALUES LESS THAN (1998) , PARTITION p4 VALUES LESS THAN (1999) ,
        ->      PARTITION p5 VALUES LESS THAN (2000) , PARTITION p6 VALUES LESS THAN (2001) ,
        ->      PARTITION p7 VALUES LESS THAN (2002) , PARTITION p8 VALUES LESS THAN (2003) ,
        ->      PARTITION p9 VALUES LESS THAN (2004) , PARTITION p10 VALUES LESS THAN (2010),
        ->      PARTITION p11 VALUES LESS THAN MAXVALUE );
    Query OK, 0 rows affected (0.00 sec)
    Side node: when partitioning using range, the partitions must be defined using "VALUES LESS THAN" and the ranges must be listed in increasing order.

    If you'd rather partition by a date or datetime, it's not as easy. You cannot use a date directly (e.g., this syntax fails: RANGE(date_column)..PARTITION p0 VALUES LESS THAN ('2000-01-01')). There are plenty of workarounds

    Notice that we designed partitions for a particular year and finished with one catch-all partition to get anything that doesn't fall into any of the specific date partitions.
    Last edited by Pc Monk; Apr 15th, 2013 at 10:23 AM.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,200

    Re: archive or partition workaround

    Thread moved to the 'Database Development' forum

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Location
    San Isidro
    Posts
    326

    Re: archive or partition workaround

    hi thanks..i havent started anything to archive my data. for example i have tblbeneficiaries which has millions of records it has a filed date created, names, ages... how will i archive these data yearly so that it can still retrieve by users
    I want to learn more
    grace

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.