Amigos,
referente:
INDEX ON str(filial,2)+str(cliente,6) to ...
Exemplo:
Utilizando ADS - Funciona perfeitamente
nContaRegistros := 0
clientes->( dbsetorder(1), dbseek( str(nFilial,2)+str(nCliente,6) ) )
do while clientes->filial = nFilial .and. clientes->codigo = nCliente .and. clientes->(!eof())
nContaRegistros ++
clientes->(dbskip())
enddo
? nContaRegistros // total 423
-----------------------------------------------------------------------
Utilizando ADS - Não funciona
nContaRegistros := 0
clientes->( dbsetorder(1), dbseek( str(nFilial,2) ) )
do while clientes->filial = nFilial .and. clientes->(!eof())
nContaRegistros ++
clientes->(dbskip())
enddo
? nContaRegistros // total 5
O ADS só permite trabalhar com índice composto integral ???
Existe alguma saída para isso?
obrigado
ADS Índice Composto ( SOLUCIONADO )
ADS Índice Composto ( SOLUCIONADO )
Last edited by MGA on Tue Jun 07, 2016 9:16 pm, edited 1 time in total.
Re: ADS Índice Composto
No caso do ADS, não seria:
Code: Select all
CREATE INDEX ??
João Santos - São Paulo - Brasil
Re: ADS Índice Composto
Falta en el Dbseek un ".T."
Code: Select all
Utilizando ADS - Não funciona :(
nContaRegistros := 0
clientes->( dbsetorder(1), dbseek( str(nFilial,2), .T. ) )
do while clientes->filial = nFilial .and. clientes->(!eof())
nContaRegistros ++
clientes->(dbskip())
enddo
? nContaRegistros // total 5 :(
Un saludo
Fernando González Diez
ALSIS GHE Sistemas Informáticos
Fernando González Diez
ALSIS GHE Sistemas Informáticos
Re: ADS Índice Composto
Obrigado a todos,
segue a solução:
http://devzone.advantagedatabase.com/dz ... 31204-1609
Title:
Slow Performance, Unexpected Sort Order, Incorrect SQL Results After Converting From DBF to ADT Tables
Problem Description:
With DBF format tables creating a multi-segmented index is done with the plus ( + ) operator. A multi-segmented index expression would look like this: Field1 + Field2 + Field3. If this type of index expression is used in an ADT table there are potential performance issues, as well as a possibility for unexpected sort order results.
In version 6.x the performance issue is a result of the Advantage Server incorrectly using the multi-segmented index which contains the plus operator. In version 7.0 the Advantage Server was changed such that indexes with the plus operator were ignored. In either case performance is adversely affected.
The incorrect sort order problem is due to the fact that if one field in a multi-segmented index is NULL, the entire index key will evaluate to null. The null key can also cause problems for queries as the index would be used to to optimize a search.
Solution:
The solution to these problems is to change the operator used to create the multi-segmented index from the plus ( + ) operator to the semicolon ( ; ) operator. Using the semicolon operator will avoid all the problems mentioned above.
segue a solução:
http://devzone.advantagedatabase.com/dz ... 31204-1609
Title:
Slow Performance, Unexpected Sort Order, Incorrect SQL Results After Converting From DBF to ADT Tables
Problem Description:
With DBF format tables creating a multi-segmented index is done with the plus ( + ) operator. A multi-segmented index expression would look like this: Field1 + Field2 + Field3. If this type of index expression is used in an ADT table there are potential performance issues, as well as a possibility for unexpected sort order results.
In version 6.x the performance issue is a result of the Advantage Server incorrectly using the multi-segmented index which contains the plus operator. In version 7.0 the Advantage Server was changed such that indexes with the plus operator were ignored. In either case performance is adversely affected.
The incorrect sort order problem is due to the fact that if one field in a multi-segmented index is NULL, the entire index key will evaluate to null. The null key can also cause problems for queries as the index would be used to to optimize a search.
Solution:
The solution to these problems is to change the operator used to create the multi-segmented index from the plus ( + ) operator to the semicolon ( ; ) operator. Using the semicolon operator will avoid all the problems mentioned above.