title: Millions of rows table optimization SQL Server
body: <p>I have a table with millions of rows:</p>
  <pre><code>CREATE TABLE [dbo].[RequestIdentities]
  (
      [Id] [bigint] IDENTITY(1,1) NOT NULL,
      [UniqueKey] [nvarchar](256) NULL,
      [Timestamp] [datetime] NULL,
  
      CONSTRAINT [PK_RequestIdentities] 
          PRIMARY KEY CLUSTERED ([Id] ASC)
                      WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, 
                            IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, 
                            ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
  ) ON [PRIMARY]
  GO
  
  ALTER TABLE [dbo].[RequestIdentities] 
      ADD CONSTRAINT [DF_RequestIdentities_Timestamp]  
          DEFAULT (GETDATE()) FOR [Timestamp]
  GO 
  </code></pre>
  <p>A Web API manipulates the database using ADO.NET and does:</p>
  <ol>
  <li><p>Executes this query:</p>
  <pre><code> SELECT 1 
   FROM RequestIdentities WITH (nolock) 
   WHERE UniqueKey = @key
  </code></pre>
  </li>
  <li><p>If exists:</p>
  <pre><code> if(reader.HasRows)
  </code></pre>
  </li>
  <li><p>Returns a http response.</p>
  </li>
  <li><p>Otherwise, it inserts the id into the table:</p>
  <pre><code> INSERT INTO RequestIdentities(UniqueKey) 
   VALUES(@key)
  </code></pre>
  </li>
  </ol>
  <p>There are hundreds of inserts/updates every minutes, is there something I can do to optimize the table, like custom statistics/indexes?</p>