Question: On a php-server I capture all posted variables from $\_POST, forexample

```
var_dump($_POST);

```

This works fine if I use a html-form to post to the server.

I try to post to the server using nodejs and requestify:

```
requestify.post('http://localhost/rest/1/comment/create', {hello: 'world'})
.then(function(response) {
    console.log(response.getBody());
})

```

This will not be captured by the php-server and var\_dump($\_POST) outputs an empty array.

Answer: 
You could put an index on LogID in the table #tmpInvestorJob.

This should increase performance since it only count the rows that matches between the tables. It should be much faster because there are only a few rows in #TempTimeline.

```
UPDATE g 
SET 
  Completed =  COALESCE(a.Completed, 0)
FROM #TempTimeline g
-- using outer apply in case no matches are found to set completed to 0
OUTER APPLY 
(
  SELECT COUNT(*) Completed
  FROM #tmpInvestorJob
  WHERE
    [Status] = 3              
    and LogID = g.LogID
) a

```
If you have Enterprise edition of SQL Server you can create filtered index.

```sql
CREATE INDEX IX_tmpInvestorJob_LogID_Filtered
ON #tmpInvestorJob (LogID) 
WHERE Status = 3

```

If you are on Standard edition and it is very important query I would suggest index with Status. It isn't going be very selective, but this query is going end up using Index Scan anyway. But consider how the index going affect data modification operations.

```sql
CREATE INDEX IX_tmpInv_Status_LogID_Filtered
ON #tmpInvestorJob (Status, LogID) 

```

This query is going end up using Index Scan because there are not filters #TempTimeline. Overtime you will have lot of entries with Status = 3 (unless you clean up), so query will become inefficient. You need find a way to apply filter on #TempTimeline table. Completed column contains number of complete jobs, so it can be use for filtering, but you might have another column to limit the recordset.

Another option is to consider an indexed view which would hold an aggregated summary if you have data stored in permanent tables rather than temp tables:

```sql
CREATE VIEW dbo.vwInvCompletedJobStats
WITH SCHEMABINDING
as
SELECT LogID, COUNT(*) Completed
FROM #tmpInvestorJob /* permanent table name*/
WHERE  [Status] = 3 
GO

CREATE UNIQUE CLUSTERED INDEX IX_vwInvCompletedJobStats_LogID
ON dbo.vwInvCompletedJobStats (LogID)
GO

```

And use that view for source of the update. Make sure you test effect of Indexed view on other operations.