Sequence Sequence Slow

DBA Geral (instalação, configuração do banco, scripts do Sql*Plus, shell scripts, batch scripts, etc...)
Post Reply
alexandervinson
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 29
Joined: Wed, 17 Nov 2010 8:29 am
Location: Belem - Para

Personal my problem is as follows.
Part of my program runs a sequence many times, to be more specific about 300,000 times.
My problem is that when I analyze the trace of running one of the slower instructions is exactly the select sequence.nextval from dual
below follows the part of the trace of this query

Select all

 
SELECT sequence.NEXTVAL  
FROM 
 DUAL 
call     count       cpu    elapsed       disk      query    current        rows 
------- ------  -------- ---------- ---------- ---------- ----------  ---------- 
Parse        1      0.00       0.00          0          0          0           0 
Execute 295452      3.00  172596.12          0          0          0           0 
Fetch   295452      2.53  193335.00          0          0         30      295452 
------- ------  -------- ---------- ---------- ---------- ----------  ---------- 
total   590905      5.53  365931.12          0          0         30      295452
I have already tried several cache values ??(100,500,10,000 - ten thousand same) and the cost is always high

I do not know if it is some configuration of my bank ... something with the dual perhaps ... The queries the tables are very fast ... it is the one that is slow.
Thanks
Alex
User avatar
dr_gori
Moderador
Moderador
Posts: 5027
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Topic moved to DBA (left ghost topic here)
: -O
User avatar
fbifabio
Moderador
Moderador
Posts: 199
Joined: Tue, 22 Feb 2011 1:51 pm
Location: São Paulo - SP
Contact:

To say what may be happening I would have to know your BD environment (SGA settings etc), but it may be that the caching sequence values ??are being discarded from memory before they are used, so you end up. Having cache, what would expedite the recovery time of sequence values. On my blog I wrote an article that explains how to fix (PINAR) the values ??of the sequence cache in memory: http://www.fabioprado.net/2010/09/cache ... ences.html.
att,
Fabio Prado www.fabioprado.net
alexandervinson
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 29
Joined: Wed, 17 Nov 2010 8:29 am
Location: Belem - Para

Hi fabio ... your link está broken .. sends again please
alexandervinson
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 29
Joined: Wed, 17 Nov 2010 8:29 am
Location: Belem - Para

With Lincence for Slanga Paraense .........
"Mare" This is to make matters worse ....
I made the following test

Select all

 
declare  
 v number; 
begin 
  dbms_output.put_line(to_char(sysdate,'hh24:mi:ss')); 
  for i in 1..30000 loop 
    SELECT  sequence.NEXTVAL  
     into v from dual; 
  end loop; 
  dbms_output.put_line(to_char(sysdate,'hh24:mi:ss')); 
end;  
And returned in a second .....................
now gave the neurons came into screw ... because the tkprof shows such a bad performance QD executed in a more complex procedure?
alexandervinson
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 29
Joined: Wed, 17 Nov 2010 8:29 am
Location: Belem - Para

Talk personal,
good the new thing is that I made a simple select tkprof of the sequence ... and look at the absurd that appeared ....
but the procedure runs fast .. so I I think I'm reading the results in an incorrect way .... Alquem can help me interpret this?




My interpretation from the beginning was that it was taking 20337 seconds, since in the header the file tells me Elapsed = Elapsed Time in Seconds Execution. However this is incorrect since the block executed in less than 1 followed ....
ecalvetti
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 13
Joined: Wed, 22 Apr 2009 11:43 am
Location: Florianópolis - SC

Alexandervinson

gives a researched there to ensure ... but I believe that this metric in Oracle is measured in microseconds. In that case, you would have to split the result per 1000000 to give the result in seconds.
Let's see if someone with more experience agrees or disagrees ...

ABS.,
Calvetti
] OCA - Oracle Certified Associates
ITIL Foundation
alexandervinson
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 29
Joined: Wed, 17 Nov 2010 8:29 am
Location: Belem - Para

Personal,
I did a test ...
I did the TKProf of a block that only had the sequence call. And for my spoiling the steep number on the Elapsed column continued giant. But the block executed very quickly.

So I conclude that, although in the title of the TKProf file is written

Select all

elapsed  = elapsed time in seconds executing
This is not true if it is too fast, then it must be in milliseconds as informed by Ecalvetti

Thanks to all for aid

Alex
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest