ADS Índice Composto ( SOLUCIONADO )

ADS Índice Composto ( SOLUCIONADO )

Postby MGA » Mon Jun 06, 2016 4:52 pm

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
Last edited by MGA on Tue Jun 07, 2016 9:16 pm, edited 1 time in total.
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1249
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: ADS Índice Composto

Postby karinha » Mon Jun 06, 2016 6:22 pm

No caso do ADS, não seria:

Code: Select all  Expand view

CREATE INDEX ??
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7800
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ADS Índice Composto

Postby fgondi » Tue Jun 07, 2016 4:20 pm

Falta en el Dbseek un ".T."


Code: Select all  Expand view
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 Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: ADS Índice Composto

Postby MGA » Tue Jun 07, 2016 7:32 pm

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.
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1249
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft, Google [Bot] and 54 guests