Unix Technical Forum

DESC index column

This is a discussion on DESC index column within the MySQL General forum forums, part of the MySQL category; --> Hi all - Is there a good workaround for mysql's lack of 'DESC' functionality when creating an index? I'm ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-24-2008, 06:09 AM
Bof
 
Posts: n/a
Default DESC index column

Hi all -
Is there a good workaround for mysql's lack of 'DESC'
functionality when creating an index?

I'm looking at migrating an Oracle RAC database to
mysql (InnoDB or Cluster - testing both at the
moment), and the Oracle database uses a lot of
multi-column indexes with some colums indexed in
descending order.

If I can't emulate the descending index colums somehow
it's likely to seriously impact performance and
possibly derail the prospect of migration - help!

cheers
Iain
--









Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-24-2008, 06:09 AM
Phil
 
Posts: n/a
Default Re: DESC index column

What I've done in the past is to create extra columns which contain the
reverse of a number/date used previously in an index.

So, for instance if it's a simple INT column (A) and you know the max would
be 9999999 for example, create an extra column and populate that with
(10000000 - A) and use it as an ASC index.

Same can be done with dates.

Not always applicable, but it works and is fairly easy to implement.

Phil

On Tue, May 20, 2008 at 2:20 PM, Bof <bof90@yahoo.com> wrote:

> Hi all -
> Is there a good workaround for mysql's lack of 'DESC'
> functionality when creating an index?
>
> I'm looking at migrating an Oracle RAC database to
> mysql (InnoDB or Cluster - testing both at the
> moment), and the Oracle database uses a lot of
> multi-column indexes with some colums indexed in
> descending order.
>
> If I can't emulate the descending index colums somehow
> it's likely to seriously impact performance and
> possibly derail the prospect of migration - help!
>
> cheers
> Iain
> --
>
>
>
>
>
>
>
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=pchapman@nc.rr.com
>




--
Help build our city at http://free-dc.myminicity.com !

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-24-2008, 06:09 AM
Bof
 
Posts: n/a
Default Re: DESC index column

Hi Phil -

Thanks for the suggestion. Might that involve possibly
changing queries in the web application hitting the
database so that it uses the new column, or would the
indexing on the new column take care of speeding up
the existing queries?

cheers
Iain
--


--- Phil <freedc.bok@gmail.com> wrote:

> What I've done in the past is to create extra
> columns which contain the
> reverse of a number/date used previously in an
> index.
>
> So, for instance if it's a simple INT column (A) and
> you know the max would
> be 9999999 for example, create an extra column and
> populate that with
> (10000000 - A) and use it as an ASC index.
>
> Same can be done with dates.
>
> Not always applicable, but it works and is fairly
> easy to implement.
>
> Phil
>
> On Tue, May 20, 2008 at 2:20 PM, Bof
> <bof90@yahoo.com> wrote:
>
> > Hi all -
> > Is there a good workaround for mysql's lack of

> 'DESC'
> > functionality when creating an index?
> >
> > I'm looking at migrating an Oracle RAC database to
> > mysql (InnoDB or Cluster - testing both at the
> > moment), and the Oracle database uses a lot of
> > multi-column indexes with some colums indexed in
> > descending order.
> >
> > If I can't emulate the descending index colums

> somehow
> > it's likely to seriously impact performance and
> > possibly derail the prospect of migration - help!
> >
> > cheers
> > Iain
> > --
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:

>

http://lists.mysql.com/mysql?unsub=pchapman@nc.rr.com
> >

>
>
>
> --
> Help build our city at http://free-dc.myminicity.com
> !
>





Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-24-2008, 06:09 AM
Phil
 
Posts: n/a
Default Re: DESC index column

yes, you'd have to alter the queries to use the new index. As I say it's
very application dependent and does not always apply, but you can normally
shoehorn any application to use it.

Phil

On Wed, May 21, 2008 at 9:22 AM, Bof <bof90@yahoo.com> wrote:

> Hi Phil -
>
> Thanks for the suggestion. Might that involve possibly
> changing queries in the web application hitting the
> database so that it uses the new column, or would the
> indexing on the new column take care of speeding up
> the existing queries?
>
> cheers
> Iain
> --
>
>
> --- Phil <freedc.bok@gmail.com> wrote:
>
> > What I've done in the past is to create extra
> > columns which contain the
> > reverse of a number/date used previously in an
> > index.
> >
> > So, for instance if it's a simple INT column (A) and
> > you know the max would
> > be 9999999 for example, create an extra column and
> > populate that with
> > (10000000 - A) and use it as an ASC index.
> >
> > Same can be done with dates.
> >
> > Not always applicable, but it works and is fairly
> > easy to implement.
> >
> > Phil
> >
> > On Tue, May 20, 2008 at 2:20 PM, Bof
> > <bof90@yahoo.com> wrote:
> >
> > > Hi all -
> > > Is there a good workaround for mysql's lack of

> > 'DESC'
> > > functionality when creating an index?
> > >
> > > I'm looking at migrating an Oracle RAC database to
> > > mysql (InnoDB or Cluster - testing both at the
> > > moment), and the Oracle database uses a lot of
> > > multi-column indexes with some colums indexed in
> > > descending order.
> > >
> > > If I can't emulate the descending index colums

> > somehow
> > > it's likely to seriously impact performance and
> > > possibly derail the prospect of migration - help!
> > >
> > > cheers
> > > Iain
> > > --
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > MySQL General Mailing List
> > > For list archives: http://lists.mysql.com/mysql
> > > To unsubscribe:

> >

> http://lists.mysql.com/mysql?unsub=pchapman@nc.rr.com
> > >

> >
> >
> >
> > --
> > Help build our city at http://free-dc.myminicity.com
> > !
> >

>
>
>
>
>



--
Help build our city at http://free-dc.myminicity.com !

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-24-2008, 06:09 AM
Rob Wultsch
 
Posts: n/a
Default Re: DESC index column

On Tue, May 20, 2008 at 11:20 AM, Bof <bof90@yahoo.com> wrote:
> Hi all -
> Is there a good workaround for mysql's lack of 'DESC'
> functionality when creating an index?
>
> I'm looking at migrating an Oracle RAC database to
> mysql (InnoDB or Cluster - testing both at the
> moment), and the Oracle database uses a lot of
> multi-column indexes with some colums indexed in
> descending order.
>
> If I can't emulate the descending index colums somehow
> it's likely to seriously impact performance and
> possibly derail the prospect of migration - help!
>
> cheers
> Iain


I have not yet run into performance issues with indexes not being
stored ascending.

Running queries with ORDER BY indexed_field ASC appears to me to have
the same or near the same performance characteristics as ORDER BY
indexed_field DESC. What are the circumstances where this crops up as
an issue?

--
Rob Wultsch
wultsch@gmail.com
wultsch (aim)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:16 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com