Question: I have the issue of using GROUP BY when select all the column from the table and in result with the poor performance in term of speed.

```
Select * from employee
group by customer_id;

```

The query above wouldn't be change,it is mandatory and fixed.It takes 17720ms is to long and the result must take shorter time, which is below 1 minute as my desired result.Since the table has many column and record, so it take much time in query searching.Is there any solution to solve this problem.Thanks.

Answer: 
For as simple as your query is, it appears almost pointless... You would not have duplicate employee IDs within an employee table, and doing a group by would still result in returning every row, every column.

However, that said, to optimize a GROUP BY, you would need an index on that column ... which I would think would already exist as the employee ID would probably be the primary key to the table. 

Additionally, you don't have any aggregate columns what would warrant a group by. Are you instead just trying to LOOK for a specific employee? If so, that would be a different query using a WHERE clause for the criteria you are looking for.

FEEDBACK...

You updated your question and did a group by CUSTOMER ID (not employee ID). Ok, but what do you really mean to group by..

OR... Did you want to ORDER by a customer... In other words, I want a list of all employees, but want them sorted by the customer they are associated with... If this is the case, you would want something like...

```
select *
   from employees
   ORDER BY
      customerID, 
      employeeLastName,
      employeeFirstName

```

Without seeing your table structure(s), but if the employee table DOES have a column for the customer ID they are associated with, this query would put all employees for the same customer in a common PRE-SORT output by customer, then within that customer, sorted by the employees name (last, first).

If you have another table(s) with relationships between employees and customers, we would need to see that too to better offer an answer.
The `GROUP BY` is not just weird, it is *wrong*. If you don't specify all the non-aggregate columns in the `GROUP BY`, you get seemingly random values for each column. Remove the GROUP BY or explain why you think you need it.

Or maybe the "\*" is not correct. OK, you cannot show us your real column names, at least show us the real pattern to the SELECT, even if it has bogus column names.

I'm also confused as to why you call it a "search". There is no WHERE clause, which is where "search" criteria goes.