Question: I have a SQL Server database that contains usage data of an application (from over 100 devices), with over 1 year of data collected (30GB database).

Inserting data into the DB is not a problem, is fast enough (for now), and is the only operation done by the clients.

There is one master table and a few child tables, but let's say I can put everything in a single table.

I need to do statistical analysis, so mostly `count(*)` filtering by date and by one or more columns. Performance is getting slow (done everything I could with indexes).

Would moving to MongoDB improve the speed? I haven't started to study it, but 99% of my operations would be (yes I know is not SQL):

```
select count(*) from table 
where date between date1 and date2 and field1 = 10 and field2 = "test"

```

Answer: 
Your requirements can be easily handled by sql server.
 by the use of proper indexes and other optimization techniques. these queries can be execute efficiently by SQL SERVER. for your use case a sinmple index on (date,field1,field2)

```
CREATE CLUSTERED INDEX IDX_TABLE_ID ON TABLE(id)
GO
CREATE  INDEX IDX_TABLE_2 ON TABLE(date,field1,field2)
GO

```

can be sufficient for fast query execution. 

**just a note:** 
For archival analysis SQL server Provides data warehousing tools(SQL SERVER ANALYSIS SERVICE).
SQL SEREVER CUBE can aggregate and make analysis of huge archive data very simple. 

for other sql server information : <http://ms-sql-queries.blogspot.in/>
If you aren't using any joins within the query then the performance of the sql server will not be affected. If you use mongodb for the same purpose then also the querying time will be about that of the sql one or a little worse.