List:General Discussion« Previous MessageNext Message »
From:Adarsh Sharma Date:September 21 2012 12:08pm
Subject:Re: Partitioning on a Substring of Varchar Column in Mysql
View as plain text  
Just update the string needed function substring(id,9,6).

On Fri, Sep 21, 2012 at 5:18 PM, Adarsh Sharma <eddy.adarsh@stripped>wrote:

> Hi all,
>
> I created a partition on a timstamp column ( dt_dtamp ) in mysql-5.1.58
> testing table.But as all of us know that partitioned column need to be
> primary key.
> I have already id column as primary key but my application cann't afford
>  primary key ('id','dt_stamp') in a table.
>
> I thought & tried PRIMARY KEY ( 'id','dt_dtamp')  & UNIQUE ('id') will
> work but below error came :
>
> ERROR 1503 (HY000): A UNIQUE INDEX must include all columns in the table's
> partitioning function
>
> as it is clearly mentioned in
>
> http://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations-partitioning-keys-unique-keys.html
> .
>
> Is it possible i can create partitioning on a substring of varchar(255) (
> id ) column. Below are the some contents of my id column :-
>
>  0038000-120614070130414-sudoie-sudoi-C@86 |
> | 0038000-120614070130414-sudoie-sudoi-C@87 |
> | 0038000-120614070130414-sudoie-sudoi-C@88 |
> | 0038000-120614070130414-sudoie-sudoi-C@89 |
> | 0038000-120614070130414-sudoie-sudoi-C@90 |
> | 0038000-120614070130414-sudoie-sudoi-C@91 |
> | 0038000-120614070130414-sudoie-sudoi-C@92 |
> | 0038000-120614070130414-sudoie-sudoi-C@93 |
> | 0038000-120614070130414-sudoie-sudoi-C@94 |
> | 0038000-120614070130414-sudoie-sudoi-C@95 |
> | 0038000-120614070130414-sudoie-sudoi-C@96 |
>
> It includes date in it. Can i make my partitioning on string after first
> hyphen : 120614
>
> Is it possible in mysql5.1.58 or may be higher versions so that i have
> only primary key ('id') on my table. Need a crack for it.
>
>
> Thanks
>

Thread
Partitioning on a Substring of Varchar Column in MysqlAdarsh Sharma21 Sep
  • Re: Partitioning on a Substring of Varchar Column in MysqlAdarsh Sharma21 Sep
    • RE: Partitioning on a Substring of Varchar Column in MysqlRick James21 Sep
      • Re: Partitioning on a Substring of Varchar Column in MysqlAdarsh Sharma23 Sep