Subject | RE: [firebird-support] Looking for advice on indexes |
---|---|
Author | Leyne, Sean |
Post date | 2013-05-03T17:18:09Z |
Marcin,
Sean
> I have following table named TSH:For this query, a DESCENDING compound index with the ID and WORK_DATE would be best.
>
> ID INTEGER
> SITE VARCHAR(50)
> WORK_DATE DATE
>
> each day there are 10 up to 15 records inserted with various sites.
> The list of sites is quite limited and consists of around 50 items.
>
> Then I have following query
>
> SELECT SITE_ID, MAX(WORK_DATE)
> FROM TSH
> GROUP BY 1
>
> to get the latest entry for each site
>
> What indexes should I create to get this query as quickest as possible?
Sean