I have a table (lets call it 'actions') that lists all actions completed by a bunch of different clients.

I want to get a list of distinct action types for a specific client.
I also know that there are 100 action types in the system

I've tried the obvious:

```
SELECT DISTINCT actionType FROM actions WHERE clientId = @clientId

```

But it's very slow due to the large number of records in the table.

I'm now working on a query that uses exists to get a list of actionTypes that I suspect will be faster:

```
SELECT 'actionType1' WHERE EXISTS (SELECT TOP 1 * FROM actions WHERE 
   clientId = @clientID AND actionType = 'actionType1' ) 
UNION 
SELECT 'actionType2' WHERE EXISTS (SELECT TOP 1 * FROM actions WHERE 
   clientId = @clientID AND actionType = 'actionType2' ) 
UNION
.
.
.
UNION
SELECT 'actionType100' WHERE EXISTS (SELECT TOP 1 * FROM actions WHERE 
       clientId = @clientID AND actionType = 'actionType100' ) 

```

While I expect this to be faster (and hopefully fast enough) it feels very hacky to me 
Can someone suggest a better way to do this?

Cheers,
A

Update:
The select distinct was taking 3 seconds yesterday, its now running instantly! I wonder if someone has added an index. I will check

As suspected by a few people, the second query is actually much slower than the distinct, it is taking 4 seconds to run!