Subject
Author toninhonunes
Hi,

I have one query with many fields and 13 datasets for ib_lookupcombo,
I have noted that query is very slow. The indices are corrects, for
search I'm using TIB_SearchEdit.

I also created one stored procedure to select, but not have been
solve my problem with the speed, see my source code below:

Only to open DataSets for IB_LOOKUPCOMBO one time.

procedure TFrm_Filiacao.AfterOpen( IB_Dataset: TIB_Dataset );
begin
//Open DataSets for IB_LOOKUPCOMBO
with DM_SINDICAL_ASSOCIADO do
begin
if (Tag = 0) then //IF CLOSED THEN OPEN
begin
IB_Qry_Banco.Open;
IB_Qry_Agencia.Open;
IB_Qry_AgTrabalho.Open;
IB_Qry_Cidade.Open;
IB_Qry_Escolaridade.Open;
IB_Qry_TipoAssociado.Open;
IB_Qry_Cargo.Open;
IB_Qry_Raca.Open;
IB_Qry_BancoAnt.Open;
IB_QryTrabAnt.Open;
IB_Qry_Cadastrador.Open;
IB_Qry_SituacaoAssociado.Open;
IB_Qry_Estado.Open;
Tag := 1; //DataSet Open
end;
end;
end;

Thats datasets are with 1 or 2 records only.

My Query main the statement:

SELECT MATRICULA
, NOME_ASSOCIADO
, DATA_NASCIMENTO
, NATURALIDADE
, UF_NATURALIDADE
, NACIONALIDADE
, ESTADO_CIVEL
, SEXO
, RG
, ORG_EXPEDIDOR
, DATA_EXPEDICAO
, CPF
, TITULO_ELEITOR
, ZONA_ELEITORA
, SECAO_ELEITORAL
, CTPS
, SERIE_CTPS
, LOGRADOURO_RESIDENCIAL
, PIS
, ENDERECO_RESIDENCIAL
, BAIRRO_RESIDENCIAL
, NUMERO_RESIDENCIAL
, CEP_RESIDENCIAL
, DATA_ADMISSAO
, SITUACAO_MORADIA
, FILIACAO_PAI
, FILIACAO_MAE
, AGENCIA_TRABALHO
, AGENCIA_COBRANCA
, CONTA_NO_BANCO
, SALARIO_BASE
, DATA_FILIACAO
, DATA_FICHA_DIGITADA
, DATA_DEMISSAO
, TELEFONE_RESIDENCIAL1
, TELEFONE_CELULAR
, TELEFONE_RESIDENCIAL2
, EMAIL
, CODIGO_RACA
, CODIGO_TIPO
, CODIGO_SITUACAO
, CODIGO_ESCOLARIDADE
, CODIGO_CORREIO
, BANCO_TRAB_ANTERIOR
, SALARIO_LIQUIDO
, MATRICULA_NO_BANCO
, FOTO
, AGENCIA_TRAB_ANTERIOR
, CODIGO_BANCO
, CODIGO_CIDADE
, CARGO_DESCRITIVO
, CODIGO_CARGO
, DATA_APOSENTADORIA
, MATRICULA_CADASTRADOR
, OBSERVACAO
, USA_CONVENIO
, LIMITE_PERCENTUAL
, ATIVO_INATIVO
FROM ASSOCIADO_S

THE ASSOCIADO_S is a stored procedure, the plan is correct also, seek
below:

PLAN SORT ((ASSOCIADO ORDER RDB$PRIMARY3))

MATRICULA = RDB$PRIMARY3

When I execute one search, it's appear to be very slow, when I don't
use ib_lookupcombo and the datasets closed, it's appear to be more
fast.

Could someone please help-me?

Thanks in advance!

Toninho Nunes