Re: [firebird-support] MAX() and index

2015-09-07 Thread Jesus Garcia jeg...@gmail.com [firebird-support]
> El 7/9/2015, a las 15:00, Tim Ward t...@telensa.com [firebird-support] > escribió: > > Please can someone explain to me, again, why > > select Max(MYCOL) from MYTAB > > doesn't use the primary key > > PLAN (MYTAB NATURAL) > I think you need to have a

Re: [firebird-support] MAX() and index

2015-09-07 Thread fabianoas...@gmail.com [firebird-support]
You need to use a descending index for it (pk can be descending also). Also change your sql to: Select first 1 mycol from mytab order by mycol desc This will have the spected result. Em 07/09/2015 10:00, "Tim Ward t...@telensa.com [firebird-support]" < firebird-support@yahoogroups.com> escreveu:

[firebird-support] MAX() and index

2015-09-07 Thread Tim Ward t...@telensa.com [firebird-support]
Please can someone explain to me, again, why select Max(MYCOL) from MYTAB doesn't use the primary key PLAN (MYTAB NATURAL) Current memory = 3074072 Delta memory = -20 Max memory = 3217516 Elapsed time= 0.27 sec Buffers = 150 Reads = 1811 Writes 0