View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 06:20 AM
Afan Pasalic
 
Posts: n/a
Default Re: indexing order column



Baron Schwartz wrote:
> Hi Afan,
>
> Afan Pasalic wrote:
>> hi,
>> if I have column order_id(int(4)) null do I have to index it too. I'm
>> going to use it ONLY for sorting records.

>
> It depends a lot on how much data is in the table, etc etc. An index
> will make sorting more efficient in the general case when you have a
> decent amount of data. But it's hard to be specific with so little
> information.
>
> Baron
>

I have table products (product_id is PK). I have table categories
(cat_id is PK). since the product can be in more than one category, I
have prod_cat table:
create prod_cat(
cat_id int(8) unsigned not null,
prod_id int(8) unsigned not null,
order_id int(4) unsigned null,
PRIMARY KEY (cat_id, prod_id)
) engine=Innodb;

would it be enough info?

thanks.
-afan


Reply With Quote