I've written a SQL query that looks like this:

```
SELECT * FROM MY_TABLE WHERE ID=123456789;

```

When I run it in the Query Analyzer in SQL Server Management Studio, the query never returns; instead, after about ten minutes, I get the following error: `System.OutOfMemoryException`

My server is Microsoft SQL Server (not sure what version).

```
SELECT * FROM MY_TABLE; -- return 44258086
SELECT * FROM MY_TABLE WHERE ID=123456789; -- return 5

```

The table has over forty million rows! However, I need to fetch five specific rows!

How can I work around this frustrating error?

**Edit:** The server suddenly started working fine for no discernable reason, but I'll leave this question open for anyone who wants to suggest troubleshooting steps for anyone else with this problem.