I have a SQLite database C# application which I'm running in memory (:memory:). My table has about 650k rows, which isn't much. I want to get fast response-times on the following query (syntax fetched from LINQ to SQL dynamic LINQ query)
SELECT
SUM([t0].[Value1]) AS [Sum],
[t0].[Dim1] AS [Primary],
[t0].[Dim2] AS [Secondary]
FROM [BudgetLine] AS [t0]
WHERE [t0].[BudgetID] = 4
GROUP BY [t0].[Dim1], [t0].[Dim2]
Which would be the optimal index for this query? My only index other than the primary key looks like the following...
create index IX_0 on budgetLine (BudgetID, Dim1, Dim2)
create index IX_1 on budgetLine (BudgetId)
create index IX_2 on budgetLine (Dim1, Dim2)
create index IX_3 on budgetLine (BudgetID, Dim1, Dim2,Value1)
Currently the execution times varies, but around 1s is the current average. I want this query to take less than 0.5s at least.
The table has about 50 columns.
Please assist
Update: See my 4 indexes above, with these I'm getting 0.8s response...