Subject Re: [firebird-support] Select distinct slow
Author Ann W. Harrison
willfordkc wrote:
> I have a very simple query
> SELECT DISTINCT f_gender from t_framesdata
> the table has 38 fields and 285520 rows
> the first time i run the query it is very slow taking about 30 sec
> the second time it takes about 1 sec
> Is this because there were no connections and nothing was cached or
> is there something else wrong?

Depends somewhat on the operating system. If it's a recent Windows
system, you could be seeing one of two problems.

One is that the windows journaling file systems journal files with the
extension .gdb, which was the default for InterBase and Firebird2.
Change the extension and Windows won't do you the favor of copying the
entire database whenever it's opened.

The other is that your query requires reading all 285.520 records, which
probably occupy a large number of operating system pages. Windows will
keep all the page read in its cache, avoiding disk reads for subsequent