Subject Re: [firebird-support] Fb/1.5 loop(?)
Author Helen Borrie
Hello Aage,

At 11:23 PM 15/06/2004 +0200, you wrote:
>Hi
>
>Using the table:
>CREATE TABLE TITLER (
> TNR INTEGER NOT NULL primary key
>, SLNR INTEGER
>, LAND CHAR( 3 )
>, SRT SMALLINT
>, TITTEL VARCHAR( 100 )
>, TITTEL_UC VARCHAR( 100 )
>, PRISER VARCHAR( 32 )
>, T_TYPE VARCHAR( 32 )
>);
>About 250.000 records.
>
>I want to make a nice list out of the LAND column, and the following works
>fine
> select LAND, count(*), '
> '
> from TITLER
> group by LAND, 3
> order by 2 desc
>The 3rd field is a CR/LF.
>PLAN SORT (SORT ((TITLER NATURAL)))
>The export finishes in about 2 seconds.
>
>The output is ok, but I want to have a space between columns LAND and "count".
>However, the following seems to send Fb/1.5 into never-ever land, using 99%
>of the CPU. Running Win2kPro. I gave it a couple of minutes before I
>killed it (querycide?).
> select LAND, ' ', count(*), '
> '
> from TITLER
> group by LAND, 2, 4
> order by 3 desc
>The PLAN is the same, of course.
>I'm running this from the export-pane in IB_SQL.
>I could observe the disk lights blinking, about 3 times/second.
>
>What is happening? Is this a bug? In IBO (IB_SQL) or in Fb?

Not sure what Fb will do when ask to group by nothing, but I think IBO will
have problems with exporting unnamed fields - especially since (as
variants) they have no data, i.e. your space characters (as varchars by
default) will be trimmed to empty string in transit across the wire.

As a reality test (and risking having to kill the server) do you want to
try this:

select LAND,
CAST(' ' AS CHAR) AS blank1,
count(*),
CAST(' ' AS CHAR) AS blank2
from TITLER
group by LAND, 2, 4
order by 3 desc

/heLen