Hi,
 
I have a database with 52 columns and 7 million rows.
 
The columns are Date (timestamp data type), Customer (real data type) and a bunch of other columns that indicate values for each customer on each date (all of these columns are of real data type).
 
The 'Date' column contains 5 unique values.
 
The 'Customer' column contains 1.7 million unique values.
 
1. The following query returns instantly: SELECT "CUSTOMER" FROM "TABLE".
 
2. The following query takes a long time (stopped after a few minutes): SELECT "CUSTOMER" FROM "TABLE" GROUP BY "CUSTOMER".
 
3. The following query returns instantly: SELECT "DATE", "CUSTOMER" FROM "TABLE" GROUP BY "DATE", "CUSTOMER".
 
4. The following query takes a long time (stopped after a few minutes): SELECT "CUSTOMER", "DATE" from "TABLE" GROUP BY "CUSTOMER", "DATE".
 
* Note that the only difference between query 1 and query 2 are the addition of a group by clause to query 2.
 
* Note that the only difference between query 3 and query 4 are the order of columns in the select and group by clauses.
 
Is there a way to work around this?  I'm really stuck.
 
Thanks in advance,
 
Elad


Talk to your Yahoo! Friends via Windows Live Messenger. Find Out How