SQL freeze all PCs in local network!
Hello,
I created VIEW_1 and VIEW_2 in my database like that:
CREATE VIEW "VIEW_1"
( N_MESEC,N_PAPKA,N_CC,N_SUBCC,C_SMETKA,N_BR )
AS SELECT N_MESEC,N_PAPKA,N_CC,N_SUBCC,C_SMETKA,COUNT(*) AS N_BR
FROM T_HRONOLOGIA WHERE C(C_SMETKA)='D' GROUP BY N_MESEC,N_PAPKA,N_CC,N_SUBCC,C_SMETKA;
CREATE VIEW "VIEW_2"
( N_MESEC,N_PAPKA,N_CC,N_SUBCC,N_SMETKA,N_ST,C_ANAL1,C_ANAL2,C_ANAL3,C_ANAL4,C_ANAL5,C_ANAL6,C_ANAL7,C_ANAL8,C_ANAL9,C_ANAL10,N_SMETKA2,N_ST2 )
AS SELECT T1.N_MESEC,T1.N_PAPKA,T1.N_CC,T1.N_SUBCC,T1.N_SMETKA,T1.N_ST,T1.C_ANAL1,T1.C_ANAL2,T1.C_ANAL3,T1.C_ANAL4,T1.C_ANAL5,T1.C_ANAL6,T1.C_ANAL7,T1.C_ANAL8,T1.C_ANAL9,T1.C_ANAL10,T2.N_SMETKA AS N_SMETKA2,T2.N_ST AS N_ST2
FROM T_HRONOLOGIA T1,T_HRONOLOGIA T2 WHERE C(T1.C_SMETKA)='D' AND C(T2.C_SMETKA)='K' AND T1.N_MESEC=T2.N_MESEC AND T1.N_PAPKA=T2.N_PAPKA AND T1.N_CC=T2.N_CC AND T1.N_SUBCC=T2.N_SUBCC;
and before run report I make two SQLs like that:
SELECT T1.N_MESEC,T1.N_PAPKA,T1.N_CC,T1.N_SUBCC,T1.N_SMETKA,T1.N_ST,T1.N_SMETKA2,T1.N_ST2,T2.N_BR,DIF(T2.N_BR-1,T1.N_ST,T1.N_ST2) AS N_ST3,T1.C_ANAL1,T1.C_ANAL2,T1.C_ANAL3,T1.C_ANAL4,T1.C_ANAL5,T1.C_ANAL6,T1.C_ANAL7,T1.C_ANAL8,T1.C_ANAL9,T1.C_ANAL10,(SELECT C_CCTEXT FROM T_HRONSUBTEXT WHERE T1.N_MESEC=N_MESEC AND T1.N_PAPKA=N_PAPKA AND T1.N_CC=N_CC AND T1.N_SUBCC=N_SUBCC) AS C_CCTEXT,(SELECT C_IME FROM T_SMETKOPLAN WHERE N_NOMER=T1.N_SMETKA) AS C_IME_D,(SELECT C_IME FROM T_SMETKOPLAN WHERE N_NOMER=T1.N_SMETKA2) AS C_IME_K FROM VIEW_2 T1,VIEW_1 T2 WHERE T1.N_MESEC >= :N_OT AND T1.N_MESEC <= :N_DO AND T1.N_SMETKA = :N_SMETKA AND T1.N_MESEC=T2.N_MESEC AND T1.N_PAPKA=T2.N_PAPKA AND T1.N_CC=T2.N_CC AND T1.N_SUBCC=T2.N_SUBCC ORDER BY T1.N_SMETKA2
SELECT T1.N_MESEC,T1.N_PAPKA,T1.N_CC,T1.N_SUBCC,T1.N_SMETKA,T1.N_ST,T1.N_SMETKA2,T1.N_ST2,T2.N_BR,DIF(T2.N_BR-1,T1.N_ST,T1.N_ST2) AS N_ST3,T1.C_ANAL1,T1.C_ANAL2,T1.C_ANAL3,T1.C_ANAL4,T1.C_ANAL5,T1.C_ANAL6,T1.C_ANAL7,T1.C_ANAL8,T1.C_ANAL9,T1.C_ANAL10,(SELECT C_CCTEXT FROM T_HRONSUBTEXT WHERE T1.N_MESEC=N_MESEC AND T1.N_PAPKA=N_PAPKA AND T1.N_CC=N_CC AND T1.N_SUBCC=N_SUBCC) AS C_CCTEXT,(SELECT C_IME FROM T_SMETKOPLAN WHERE N_NOMER=T1.N_SMETKA) AS C_IME_D,(SELECT C_IME FROM T_SMETKOPLAN WHERE N_NOMER=T1.N_SMETKA2) AS C_IME_K FROM VIEW_2 T1,VIEW_1 T2 WHERE T1.N_MESEC >= :N_OT AND T1.N_MESEC <= :N_DO AND T1.N_SMETKA2 = :N_SMETKA AND T1.N_MESEC=T2.N_MESEC AND T1.N_PAPKA=T2.N_PAPKA AND T1.N_CC=T2.N_CC AND T1.N_SUBCC=T2.N_SUBCC ORDER BY T1.N_SMETKA2
When run first and second sql from my Delphi application all PCs in the local network freezes, after SQL finished PCs unfreezes.
ANY IDEAS ?
Is this a problem from Firebird?
Server: Microsoft Server 2003, 2Gb RAM, Firebird 1.5.2 SS
Workstations 10-50: Windows 98/XP
I created VIEW_1 and VIEW_2 in my database like that:
CREATE VIEW "VIEW_1"
( N_MESEC,N_PAPKA,N_CC,N_SUBCC,C_SMETKA,N_BR )
AS SELECT N_MESEC,N_PAPKA,N_CC,N_SUBCC,C_SMETKA,COUNT(*) AS N_BR
FROM T_HRONOLOGIA WHERE C(C_SMETKA)='D' GROUP BY N_MESEC,N_PAPKA,N_CC,N_SUBCC,C_SMETKA;
CREATE VIEW "VIEW_2"
( N_MESEC,N_PAPKA,N_CC,N_SUBCC,N_SMETKA,N_ST,C_ANAL1,C_ANAL2,C_ANAL3,C_ANAL4,C_ANAL5,C_ANAL6,C_ANAL7,C_ANAL8,C_ANAL9,C_ANAL10,N_SMETKA2,N_ST2 )
AS SELECT T1.N_MESEC,T1.N_PAPKA,T1.N_CC,T1.N_SUBCC,T1.N_SMETKA,T1.N_ST,T1.C_ANAL1,T1.C_ANAL2,T1.C_ANAL3,T1.C_ANAL4,T1.C_ANAL5,T1.C_ANAL6,T1.C_ANAL7,T1.C_ANAL8,T1.C_ANAL9,T1.C_ANAL10,T2.N_SMETKA AS N_SMETKA2,T2.N_ST AS N_ST2
FROM T_HRONOLOGIA T1,T_HRONOLOGIA T2 WHERE C(T1.C_SMETKA)='D' AND C(T2.C_SMETKA)='K' AND T1.N_MESEC=T2.N_MESEC AND T1.N_PAPKA=T2.N_PAPKA AND T1.N_CC=T2.N_CC AND T1.N_SUBCC=T2.N_SUBCC;
and before run report I make two SQLs like that:
SELECT T1.N_MESEC,T1.N_PAPKA,T1.N_CC,T1.N_SUBCC,T1.N_SMETKA,T1.N_ST,T1.N_SMETKA2,T1.N_ST2,T2.N_BR,DIF(T2.N_BR-1,T1.N_ST,T1.N_ST2) AS N_ST3,T1.C_ANAL1,T1.C_ANAL2,T1.C_ANAL3,T1.C_ANAL4,T1.C_ANAL5,T1.C_ANAL6,T1.C_ANAL7,T1.C_ANAL8,T1.C_ANAL9,T1.C_ANAL10,(SELECT C_CCTEXT FROM T_HRONSUBTEXT WHERE T1.N_MESEC=N_MESEC AND T1.N_PAPKA=N_PAPKA AND T1.N_CC=N_CC AND T1.N_SUBCC=N_SUBCC) AS C_CCTEXT,(SELECT C_IME FROM T_SMETKOPLAN WHERE N_NOMER=T1.N_SMETKA) AS C_IME_D,(SELECT C_IME FROM T_SMETKOPLAN WHERE N_NOMER=T1.N_SMETKA2) AS C_IME_K FROM VIEW_2 T1,VIEW_1 T2 WHERE T1.N_MESEC >= :N_OT AND T1.N_MESEC <= :N_DO AND T1.N_SMETKA = :N_SMETKA AND T1.N_MESEC=T2.N_MESEC AND T1.N_PAPKA=T2.N_PAPKA AND T1.N_CC=T2.N_CC AND T1.N_SUBCC=T2.N_SUBCC ORDER BY T1.N_SMETKA2
SELECT T1.N_MESEC,T1.N_PAPKA,T1.N_CC,T1.N_SUBCC,T1.N_SMETKA,T1.N_ST,T1.N_SMETKA2,T1.N_ST2,T2.N_BR,DIF(T2.N_BR-1,T1.N_ST,T1.N_ST2) AS N_ST3,T1.C_ANAL1,T1.C_ANAL2,T1.C_ANAL3,T1.C_ANAL4,T1.C_ANAL5,T1.C_ANAL6,T1.C_ANAL7,T1.C_ANAL8,T1.C_ANAL9,T1.C_ANAL10,(SELECT C_CCTEXT FROM T_HRONSUBTEXT WHERE T1.N_MESEC=N_MESEC AND T1.N_PAPKA=N_PAPKA AND T1.N_CC=N_CC AND T1.N_SUBCC=N_SUBCC) AS C_CCTEXT,(SELECT C_IME FROM T_SMETKOPLAN WHERE N_NOMER=T1.N_SMETKA) AS C_IME_D,(SELECT C_IME FROM T_SMETKOPLAN WHERE N_NOMER=T1.N_SMETKA2) AS C_IME_K FROM VIEW_2 T1,VIEW_1 T2 WHERE T1.N_MESEC >= :N_OT AND T1.N_MESEC <= :N_DO AND T1.N_SMETKA2 = :N_SMETKA AND T1.N_MESEC=T2.N_MESEC AND T1.N_PAPKA=T2.N_PAPKA AND T1.N_CC=T2.N_CC AND T1.N_SUBCC=T2.N_SUBCC ORDER BY T1.N_SMETKA2
When run first and second sql from my Delphi application all PCs in the local network freezes, after SQL finished PCs unfreezes.
ANY IDEAS ?
Is this a problem from Firebird?
Server: Microsoft Server 2003, 2Gb RAM, Firebird 1.5.2 SS
Workstations 10-50: Windows 98/XP