Certain values for WHERE clause involving foreign key are slow
===

This query works:

    SELECT [ID]
      ,[PROJECT_ID]
      ,[NAME]
      ,[LOCATION]
      ,[COMMENT]
    FROM table1
    WHERE PROJECT_ID = 4479

but this one doesn't:

    SELECT [ID]
      ,[PROJECT_ID]
      ,[NAME]
      ,[LOCATION]
      ,[COMMENT]
    FROM table1
    WHERE PROJECT_ID = 3560

It spins and spins indefinitely. The only difference is the value used.

"PROJECT_ID" is a foreign key, and there is an index defined with it as the sole column (per usual with FKs).

In parallel: there is high fragmentation on the FK indexes on this table.

Are these probably related, ie, if I rebuild indexes should I expect the problem will be fixed?

I cannot rebuild them now as it is a production system and my understanding is I can only rebuild indexes when locks can be obtained... such as late tonight.

Any guidance on how to "force a rebuild of all indexes in all tables in a database even if it disconnects users" is also appreciated.

Thanks,
- Jesse
