Go Back   Rhinocerus > Newsgroup > Newsgroup comp.databases.oracle.server

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 04-27-2012, 08:08 PM
Dan
Guest
 
Posts: n/a
Default Index Organized table - hanging on selects

We are running Oracle 11g and seem to be encountering an occasional
problem in which index organized tables (IOT) are hanging for a long
time upon a select. Locks are the causing it, and it eventually
returns data, but even if doing a "select * from iot_table" it may
take 5 minutes to return rows in TOAD, when this normally is
instantaneous.

We have a large query in which one of the tables joined to is an IOT.
Every once in a while (maybe 5% of the time) a query will slow up to
the point that a 1 hour query could take 2 days. It doesn't happen
all the time. Yesterday on a particularly troublesome query I
recreated the IOT as a heap table with an index and the query ran as
expected.

Has anyone encountered issues like this? IOT's are suppsed to be
faster while reading? Is there a bug or a problem perhaps with how
I'm building the table?

Thanks,
Dan
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 04-27-2012, 09:58 PM
joel garry
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

On Apr 27, 1:08*pm, Dan <daniel.oster...@visaer.com> wrote:
> We are running Oracle 11g and seem to be encountering an occasional
> problem in which index organized tables (IOT) are hanging for a long
> time upon a select. *Locks are the causing it, and it eventually
> returns data, but even if doing a "select * from iot_table" it may
> take 5 minutes to return rows in TOAD, when this normally is
> instantaneous.
>
> We have a large query in which one of the tables joined to is an IOT.
> Every once in a while (maybe 5% of the time) a query will slow up to
> the point that a 1 hour query could take 2 days. *It doesn't happen
> all the time. *Yesterday on a particularly troublesome query I
> recreated the IOT as a heap table with an index and the query ran as
> expected.
>
> Has anyone encountered issues like this? *IOT's are suppsed to be
> faster while reading? *Is there a bug or a problem perhaps with how
> I'm building the table?
>
> Thanks,
> Dan


You might go into enterprise manager and see what the waiting is all
about.

jg
--
@home.com is bogus.
http://www.utsandiego.com/news/2012/...mortgage-scam/
Reply With Quote
  #3 (permalink)  
Old 04-28-2012, 12:23 AM
Mladen Gogala
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

On Fri, 27 Apr 2012 13:08:43 -0700, Dan wrote:

> We are running Oracle 11g and seem to be encountering an occasional
> problem in which index organized tables (IOT) are hanging for a long
> time upon a select. Locks are the causing it, and it eventually returns
> data, but even if doing a "select * from iot_table" it may take 5
> minutes to return rows in TOAD, when this normally is instantaneous.


Dan, Oracle doesn't use locking for query processing. The only exception
from that rule is distributed transaction processing. That makes locks
unlikely culprit for the "hanging".

>
> We have a large query in which one of the tables joined to is an IOT.
> Every once in a while (maybe 5% of the time) a query will slow up to the
> point that a 1 hour query could take 2 days. It doesn't happen all the
> time. Yesterday on a particularly troublesome query I recreated the IOT
> as a heap table with an index and the query ran as expected.


Do you have performance tuning and diagnostic pack licenses? I would
strongly advise using dbms_xplan.display_awr and even creating a tuning
task. Also, tracing the application may be a good idea. DBMS_MONITOR has
many options that would enable you to trace an application of your
choice. What you are interested in are wait events and the time spent
waiting. Also, taking a look at the AWR reports for the period in which
the slowness occurs would probably be a good idea, too.

>
> Has anyone encountered issues like this? IOT's are suppsed to be faster
> while reading? Is there a bug or a problem perhaps with how I'm
> building the table?
>
> Thanks,
> Dan


Dan, tables are collections of rows and are usually not going anywhere,
if things are done right. Table is a place, application is a process.
Tables are not slow or fast, the applications that access the table are.
Saying that IOT is "faster while reading" is a nonsense. Index organized
tables are essentially indexes. They are supposed to speed up
applications which access a relatively small part of the table. IOT is
not meant for "select * from IOT". If the table is regularly accessed
using the full table scan, IOT is a bad choice. IOT is normally used for
small, frequently accessed tables of the "phone book" type. You want to
access just the information for the particular phone type. Ask the
application designer to justify his decision to use IOT.

Also, please post your RDBMS version and platform. That may help people
who would try to help you.




--
http://mgogala.byethost5.com
Reply With Quote
  #4 (permalink)  
Old 04-28-2012, 12:59 AM
John Hurley
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

On Apr 27, 4:08*pm, Dan <daniel.oster...@visaer.com> wrote:
> We are running Oracle 11g and seem to be encountering an occasional
> problem in which index organized tables (IOT) are hanging for a long
> time upon a select. *Locks are the causing it, and it eventually
> returns data, but even if doing a "select * from iot_table" it may
> take 5 minutes to return rows in TOAD, when this normally is
> instantaneous.
>
> We have a large query in which one of the tables joined to is an IOT.
> Every once in a while (maybe 5% of the time) a query will slow up to
> the point that a 1 hour query could take 2 days. *It doesn't happen
> all the time. *Yesterday on a particularly troublesome query I
> recreated the IOT as a heap table with an index and the query ran as
> expected.
>
> Has anyone encountered issues like this? *IOT's are suppsed to be
> faster while reading? *Is there a bug or a problem perhaps with how
> I'm building the table?
>
> Thanks,
> Dan


What kind of locks exactly and from where?

Try putting a 10046 trace on a session that is "hanging" on the select
command ...

If you do not have OEM on this machine lots of sample scripts that
will help diagnose locks "who is waiting for what and why" ...

As mladen ( I think ) noted what exact version and patched up to what
on which platform?
Reply With Quote
  #5 (permalink)  
Old 04-28-2012, 06:27 PM
onedbguru
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

On Friday, April 27, 2012 4:08:43 PM UTC-4, Dan wrote:
> We are running Oracle 11g and seem to be encountering an occasional
> problem in which index organized tables (IOT) are hanging for a long
> time upon a select. Locks are the causing it, and it eventually
> returns data, but even if doing a "select * from iot_table" it may
> take 5 minutes to return rows in TOAD, when this normally is
> instantaneous.
>
> We have a large query in which one of the tables joined to is an IOT.
> Every once in a while (maybe 5% of the time) a query will slow up to
> the point that a 1 hour query could take 2 days. It doesn't happen
> all the time. Yesterday on a particularly troublesome query I
> recreated the IOT as a heap table with an index and the query ran as
> expected.
>
> Has anyone encountered issues like this? IOT's are suppsed to be
> faster while reading? Is there a bug or a problem perhaps with how
> I'm building the table?
>
> Thanks,
> Dan




having slow performance on an IOT is indicative of not using the index properly. You must be looking for EXACT MATCH lookups on the entire key or at least the leading edge(s) and BEWARE of implicit data type conversions..

Example:

when you realize that:

to_date( SOME_DATE, 'dd-mon-yyyy')

is equivalent to:

to_date(
TO_CHAR(some_date),
'dd-mon-yyyy' )

and that that is really equivalent to:

to_date(
to_char(some_date,'NLS_DATE_FORMAT'),
'dd-mon-yyyy' )

You may not be getting the results you were looking for either...

Also something like datefield = to_char(sysdate,'NLS_DATE_FORMAT') is evaluating a date to a character - can you say FTS?
Reply With Quote
  #6 (permalink)  
Old 04-29-2012, 08:36 AM
Jonathan Lewis
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects


"Dan" <daniel.ostertag@visaer.com> wrote in message
news:83665304-70e2-41fd-b810-9de8915cac8e@e15g2000vbt.googlegroups.com...
| > Locks are the causing it, and it eventually
| returns data, but even if doing a "select * from iot_table" it may
| take 5 minutes to return rows in TOAD, when this normally is
| instantaneous.

Five minutes is a very long time even for all the "well-known" issues that
might have this type of effect.

How do you know that "locks are causing it" ?

Next time you see this problem in a simple "select * from iot_table" check
what the session is waiting on (v$session_wait, v$session_wait_history, or
snapshots on v$session_event), and pull the execution plan from memory.

|
| We have a large query in which one of the tables joined to is an IOT.
| Every once in a while (maybe 5% of the time) a query will slow up to
| the point that a 1 hour query could take 2 days. It doesn't happen
| all the time. Yesterday on a particularly troublesome query I
| recreated the IOT as a heap table with an index and the query ran as
| expected.
|

This could simply be a case of a change in execution plan - you haven't
told us anything to rule out the possibility for the join.
Rebuilding as a heap table with PK gives you a whole new set of stats.

| Has anyone encountered issues like this? IOT's are suppsed to be
| faster while reading? Is there a bug or a problem perhaps with how
| I'm building the table?

Unlikely, but hard to tell since you haven't told us how you are building
the table.

--
Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com
Oracle Core (Apress 2011)
http://www.apress.com/9781430239543



Reply With Quote
  #7 (permalink)  
Old 04-30-2012, 05:51 PM
Dan
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

On Apr 29, 4:36*am, "Jonathan Lewis" <jonat...@jlcomp.demon.co.uk>
wrote:
> "Dan" <daniel.oster...@visaer.com> wrote in message
>
> news:83665304-70e2-41fd-b810-9de8915cac8e@e15g2000vbt.googlegroups.com...
> | > Locks are the causing it, and it eventually
> | returns data, but even if doing a "select * from iot_table" it may
> | take 5 minutes to return rows in TOAD, when this normally is
> | instantaneous.
>
> Five minutes is a very long time even for all the "well-known" issues that
> might have this type of effect.
>
> How do you know that "locks are causing it" ?
>
> Next time you see this problem in a simple "select * from iot_table" *check
> what the session is waiting on (v$session_wait, v$session_wait_history, or
> snapshots on v$session_event), and pull the execution plan from memory.
>
> |
> | We have a large query in which one of the tables joined to is an IOT.
> | Every once in a while (maybe 5% of the time) a query will slow up to
> | the point that a 1 hour query could take 2 days. *It doesn't happen
> | all the time. *Yesterday on a particularly troublesome query I
> | recreated the IOT as a heap table with an index and the query ran as
> | expected.
> |
>
> This could simply be a case of a change in execution plan - you haven't
> told us anything to rule out the possibility for the join.
> Rebuilding as a heap table with PK gives you a whole new set of stats.
>
> | Has anyone encountered issues like this? *IOT's are suppsed to be
> | faster while reading? *Is there a bug or a problem perhaps with how
> | I'm building the table?
>
> Unlikely, but hard to tell since you haven't told us how you are building
> the table.
>
> --
> Regards
>
> Jonathan Lewishttp://jonathanlewis.wordpress.com
> Oracle Core (Apress 2011)http://www.apress.com/9781430239543


Thanks for all the help on this.
I might have misled everyone when I said "locking". The point is that
there are no locks happening. If there were locks I could easily
address them. The query just marches along at a very slow pace but
nothing seems amiss while running. It seems like a lock but it
clearly isn't - especially when this is a select query, not an update
or insert. I'm currently in the process of analyzing my AWR reports
to see if there is anything out of place. I'm not doing a 'select *'
on the table, I just used that as an example of how selects were VERY
slow. If I do select * or "select * from IOT where", it is equally
slow.

Per one person's advice, it may be best to abandon the IOT in
general. We aren't doing full scans on it but we are stepping thru
almost every record getting a particular score for everyone in our
driving table. It's accessed by an index but maybe a heap table would
be better...not sure yet.

My main purpose was just to see if anyone else has had (or heard of)
issues with IOT's in which the table occasionally performs very slowly
on a select (I know writes/updates are slow). Another person in my
company experienced the same problem several months ago in which a
newly created IOT was completely inaccessible, it completely hanged on
select (with no locks present). Very strange...

Dan
Reply With Quote
  #8 (permalink)  
Old 04-30-2012, 08:22 PM
Robert Klemme
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

On 30.04.2012 19:51, Dan wrote:
> I might have misled everyone when I said "locking". The point is that
> there are no locks happening. If there were locks I could easily
> address them. The query just marches along at a very slow pace but
> nothing seems amiss while running. It seems like a lock but it
> clearly isn't - especially when this is a select query, not an update
> or insert.


If there is a lot concurrent update activity on the table slow access to
Undo might be an explanation.

> My main purpose was just to see if anyone else has had (or heard of)
> issues with IOT's in which the table occasionally performs very slowly
> on a select (I know writes/updates are slow). Another person in my
> company experienced the same problem several months ago in which a
> newly created IOT was completely inaccessible, it completely hanged on
> select (with no locks present). Very strange...


The first step would be to look at execution plans as has been
suggested. What did that turn up?

Kind regards

robert


--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Reply With Quote
  #9 (permalink)  
Old 04-30-2012, 10:18 PM
John Hurley
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

Dan:

> My main purpose was just to see if anyone else has had (or heard of)
> issues with IOT's in which the table occasionally performs very slowly
> on a select (I know writes/updates are slow). *Another person in my
> company experienced the same problem several months ago in which a
> newly created IOT was completely inaccessible, it completely hanged on
> select (with no locks present). *Very strange...


I still do not think you have provided any specific details on your
database environment level / patching / os platform etc.

Can you produce a reproducible test case?

Can you get a 10046 trace of a complete execution of something that
you believe is not working well?

With a 10046 trace and a resource profiler ( like the free orasrp )
you have the tools to figure out what is slow and ( hopefully
eventually ) why.

Cary Millsaps book "Optimizing Oracle Performance" gives the road map
for attacking stuff like this.
Reply With Quote
  #10 (permalink)  
Old 05-02-2012, 08:27 PM
Dan
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

On Apr 30, 6:18*pm, John Hurley <johnthehur...@gmail.com> wrote:
> Dan:
>
> > My main purpose was just to see if anyone else has had (or heard of)
> > issues with IOT's in which the table occasionally performs very slowly
> > on a select (I know writes/updates are slow). *Another person in my
> > company experienced the same problem several months ago in which a
> > newly created IOT was completely inaccessible, it completely hanged on
> > select (with no locks present). *Very strange...

>
> I still do not think you have provided any specific details on your
> database environment level / patching / os platform etc.
>
> Can you produce a reproducible test case?
>
> Can you get a 10046 trace of a complete execution of something that
> you believe is not working well?
>
> With a 10046 trace and a resource profiler ( like the free orasrp )
> you have the tools to figure out what is slow and ( hopefully
> eventually ) why.
>
> Cary Millsaps book "Optimizing Oracle Performance" gives the road map
> for attacking stuff like this.


I am running Oracle 11.2.0.2.0 on a Windows 64 machine, Windows 8 OS.
We have Oracle standard edition.

I don't have any test case at this moment because the problems are
intermittant. But I am 99% sure that the IOT in general is my
problem. We've been running this same SQL statement for years with
the same 4 tables joining together in a CTAS that produces a new
table. It has been running fine forever, but every once in a while
this happens. And it seems to happen more and more lately. I have
gone thru (and had Oracle go thru on an SR) all sorts of logs,
optimizer plans, AWR reports, etc and nothing pops up.

But, when a problem does happen all I need to do is recreate the IOT
as a heap table with an index (all 3 fields indexed), then have the
user resubmit the job. Then everything works fine and finishes in,
say, 15 minutes instead of 2 days. My solution now - without some
epiphany or new information - is to change the application and abandon
IOTs and use indexed heap tables instead.

Dan
Reply With Quote
  #11 (permalink)  
Old 05-02-2012, 08:41 PM
joel garry
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

On May 2, 1:27*pm, Dan <daniel.oster...@visaer.com> wrote:
> On Apr 30, 6:18*pm, John Hurley <johnthehur...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > Dan:

>
> > > My main purpose was just to see if anyone else has had (or heard of)
> > > issues with IOT's in which the table occasionally performs very slowly
> > > on a select (I know writes/updates are slow). *Another person in my
> > > company experienced the same problem several months ago in which a
> > > newly created IOT was completely inaccessible, it completely hanged on
> > > select (with no locks present). *Very strange...

>
> > I still do not think you have provided any specific details on your
> > database environment level / patching / os platform etc.

>
> > Can you produce a reproducible test case?

>
> > Can you get a 10046 trace of a complete execution of something that
> > you believe is not working well?

>
> > With a 10046 trace and a resource profiler ( like the free orasrp )
> > you have the tools to figure out what is slow and ( hopefully
> > eventually ) why.

>
> > Cary Millsaps book "Optimizing Oracle Performance" gives the road map
> > for attacking stuff like this.

>
> I am running Oracle 11.2.0.2.0 on a Windows 64 machine, Windows 8 OS.
> We have Oracle standard edition.
>
> I don't have any test case at this moment because the problems are
> intermittant. *But I am 99% sure that the IOT in general is my
> problem. *We've been running this same SQL statement for years with
> the same 4 tables joining together in a CTAS that produces a new
> table. *It has been running fine forever, but every once in a while
> this happens. *And it seems to happen more and more lately. *I have
> gone thru (and had Oracle go thru on an SR) all sorts of logs,
> optimizer plans, AWR reports, etc and nothing pops up.
>
> But, when a problem does happen all I need to do is recreate the IOT
> as a heap table with an index (all 3 fields indexed), then have the
> user resubmit the job. *Then everything works fine and finishes in,
> say, 15 minutes instead of 2 days. *My solution now - without some
> epiphany or new information - is to change the application and abandon
> IOTs and use indexed heap tables instead.
>
> Dan


Was it raining? http://lmgtfy.com/?q=%22According+to...vily+Monday%22

jg
--
@home.com is bogus.
Always remember to mount a scratch engineering student.
http://www.utsandiego.com/news/2012/...-him-alone-in/
Reply With Quote
  #12 (permalink)  
Old 05-03-2012, 08:24 PM
John Hurley
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects

Dan:

# I am running Oracle 11.2.0.2.0 on a Windows 64 machine, Windows 8
OS.

On windows 8? That has not been released into production yet has it?
Your users are running stuff against a database on a pre release
version of windows?

I only have one 11.2 system now in production but it is patched up to
11.2.0.3.2 ( just out in April PSU ).

A whole whole bunch of fixes/changes for 11.2.0.3 versus 11.2.0.2 ...
could be you are running into a bug fixed already but you are not
patched up to the most recent level?

Standard edition unfortunately probably does not allow the OEM
automatic SQL monitoring that could catch stuff ... but as noted
already getting a 10046 trace is one of the most effective ways of
getting/solving performance problems.

Please take the time to purchase and read Cary's book ... it gives a
repeatable methodology for attacking and solving problems.

Sure changing the tables definition is one way out perhaps and may
just be avoiding a bug that perhaps is already fixed by oracle ... but
don't you really want to know for sure what this is?


Reply With Quote
  #13 (permalink)  
Old 05-05-2012, 09:11 AM
Jonathan Lewis
Guest
 
Posts: n/a
Default Re: Index Organized table - hanging on selects


| "Dan" <daniel.ostertag@visaer.com> wrote in message
news:420f3f2b-88fa-40f1-8dac-490f50c0ab0e@cl4g2000vbb.googlegroups.com...
|
| I don't have any test case at this moment because the problems are
| intermittant. But I am 99% sure that the IOT in general is my
| problem. We've been running this same SQL statement for years with
| the same 4 tables joining together in a CTAS that produces a new
| table. It has been running fine forever, but every once in a while
| this happens. And it seems to happen more and more lately.
|

The obvious guess is that you have an intermittent change in execution
plan.
Have you already eliminated this possibility ?

Have you enabled extended trace for this statement to see where the time is
going and what the plan is.
I suggest the following two lines before the code that runs the statement:

alter session set events '10132 trace name context forever';
alter session set events '10046 trace name context forever, level 12';

with the following afterwards

alter session set events '10046 trace name context off';
alter session set events '10132 trace name context off';

Then accumulate the trace files until you have at least one fast one and
one slow one and check
a) The difference in work done
b) The execution plans reported.


--
Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com
Oracle Core (Apress 2011)
http://www.apress.com/9781430239543


Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 11:21 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.