List:General Discussion« Previous MessageNext Message »
From:Victor Subervi Date:January 2 2008 3:17pm
Subject:Re: Sorting Tables
View as plain text  
Either I don't understand your reply or I miscommunicated. How do I do that
when it is the tables that I want to select; that is *all* tables that are
called "xyz$variable", where "variable" is unknown but all tables begin

On Dec 31, 2007 3:59 PM, mos <mos99@stripped> wrote:

>  At 12:51 PM 12/31/2007, you wrote:
> >Hi;
> >Is it possible to sort tables within a given database? How?
> >TIA,
> >Victor
> Victor,
>      You mean physically sort the table based on a field or key so you
> don't have to do an Order By clause each time you do a Select? Not really
> because the order of the table is expected to be random unless you
> specify  an Order by clause.  The only thing I can think of is to create a
> new table, maybe temporary or Memory table and copy the data into it
> already sorted.
> drop table if exists newtable;
> create newtable like oldtable;
> insert into newtable select * from oldtable order by col1, col2;
> Now you should be able to
> Select * from NewTable;
> without sorting (if you don't update it). The order should be by
> col1,col2.
> (No guarantee)
> If you want to sort it in order to speed it up, then run an Optimize on
> the
> table.
> Mike
> --
> MySQL General Mailing List
> For list archives:
> To unsubscribe:

Sorting TablesVictor Subervi31 Dec
  • Re: Sorting Tablesmos31 Dec
    • Re: Sorting TablesVictor Subervi2 Jan
      • Re: Sorting TablesBaron Schwartz2 Jan
        • Re: Sorting TablesVictor Subervi2 Jan