Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
long running select min(timestamp) query
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 26 - 29 of 29 - Collapse all  -  Translate all to Translated (View all originals) < Older 
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bobdurie@gmail.com  
View profile  
 More options Jan 31 2008, 8:49 am
Newsgroups: comp.databases.oracle.server
From: "bobdu...@gmail.com" <bobdu...@gmail.com>
Date: Thu, 31 Jan 2008 05:49:43 -0800 (PST)
Local: Thurs, Jan 31 2008 8:49 am
Subject: Re: long running select min(timestamp) query
On Jan 31, 3:09 am, Robert Klemme <shortcut...@googlemail.com> wrote:

I probably should've prefaced this entire thread with - I'm an
applications developer, not a dba :)  I know this is a lame excuse,
but i simply don't have the time nor mandate to become an oracle guru,
i'm simply tasked with getting an application to work with oracle (and
a variety of other db's).  Every once in a while i get cycles to deal
with issues like this, but i certainly don't spend enough time doing
it.

Anyways, Charles has helped me out bigtime by pointing me in the right
direction:

>> http://richardfoote.files.wordpress.com/2007/12/index-internals-rebui...
>> Pages 133-135 show what is happening in your situation.  It appears that this is one of the few cases where an index may need to be rebuilt...

I rebuilt the index, performed the search, got a result instantly,
only 3 consistent gets!!!

One followup question, that you'll all likely laugh at.  I got into
this "mess" by having a table that we frequently perform delete from
TABLE where DATE < ? - this situation is going to continue to arise.
Should i simply schedule frequent index rebuilds?  I understand
partitioning the data is probably the way to go, but what is frequent
rebuilds the simplest solution here (by simple, i mean least knowledge/
testing/sql involved)?

Thanks again to all your help!!!  Sincerely,
Bob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Klemme  
View profile  
 More options Jan 31 2008, 12:36 pm
Newsgroups: comp.databases.oracle.server
From: Robert Klemme <shortcut...@googlemail.com>
Date: Thu, 31 Jan 2008 18:36:21 +0100
Local: Thurs, Jan 31 2008 12:36 pm
Subject: Re: long running select min(timestamp) query
On 31.01.2008 14:49, bobdu...@gmail.com wrote:

> I probably should've prefaced this entire thread with - I'm an
> applications developer, not a dba :)  I know this is a lame excuse,
> but i simply don't have the time nor mandate to become an oracle guru,
> i'm simply tasked with getting an application to work with oracle (and
> a variety of other db's).  Every once in a while i get cycles to deal
> with issues like this, but i certainly don't spend enough time doing
> it.

No worries, it will just take a bit longer to become an Oracle guru.
Eventually you'll get there. :-)

> Anyways, Charles has helped me out bigtime by pointing me in the right
> direction:
>>> http://richardfoote.files.wordpress.com/2007/12/index-internals-rebui...
>>> Pages 133-135 show what is happening in your situation.  It appears that this is one of the few cases where an index may need to be rebuilt...

> I rebuilt the index, performed the search, got a result instantly,
> only 3 consistent gets!!!

> One followup question, that you'll all likely laugh at.  I got into
> this "mess" by having a table that we frequently perform delete from
> TABLE where DATE < ? - this situation is going to continue to arise.
> Should i simply schedule frequent index rebuilds?  I understand
> partitioning the data is probably the way to go, but what is frequent
> rebuilds the simplest solution here (by simple, i mean least knowledge/
> testing/sql involved)?

If your deletion is part of a batch job that is run infrequently then
it's probably easiest to just add the index rebuild to the batch.  Note
the ONLINE flag which will slow down the rebuild a bit but do not
require locking of the whole table.  So your app can continue almost
normally.

If you use partitioning in pre Oracle 11 you need to set up a job that
will create partitions properly.  And in all versions you need another
job for the deletions (again assuming they are done on a regular basis).

For this not too uncommon scenario of data coming and going time based
this MIN issue is really annoying.  IMHO Oracle should do something
about it - at least it would be nice if there was an option during index
creation that would enable automatic index tree pruning at the cost of a
bit of performance.

Kind regards

        robert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Lewis  
View profile  
 More options Feb 2 2008, 6:01 am
Newsgroups: comp.databases.oracle.server
From: "Jonathan Lewis" <jonat...@jlcomp.demon.co.uk>
Date: Sat, 2 Feb 2008 11:01:21 -0000
Local: Sat, Feb 2 2008 6:01 am
Subject: Re: long running select min(timestamp) query

<bobdu...@gmail.com> wrote in message

news:805c5d03-8e41-4fa9-b81f-6fd153f64060@v67g2000hse.googlegroups.com...

Sorry about getting into this so late - but your problem is
a classic 'delete the left hand end' issue, and one of the
reasons why you want to use the COALESCE command
after a big delete.

It's probably somewhere in Richard's presentation, but
when an index leaf block is emptied, it is linked to the
free list, but also stays in place in the index structure.

Your min() query was doing a '(min/max)' full scan, which
means it was going directly to the left (low) end of the index
in expectation of finding the value there.  However, since
you've done a thorough delete of a lot of low-value rows,
the run-time engine got to the bottom block, and had to
walk a long walk through a lot of leaf blocks before finding
the first leaf block with any data in it.

A call to coalesce will collapse together adjacent leaf blocks
to reduce leaf block counts, and detach empty leaf blocks
from the structure so that subsequent queries don't have to
walk through them.

The cost / benefit balance is:
    each coalesce requires a full walk of the index - so don't do
    it when you have a large index with only a small amount of
    recoverable space.

    failing to coalesce (for your query) requires a lot of empty
    leaf blocks to be walked - how many times do you want
    to let this happen, and how slow can the query be, before
    you coalesce.

--
Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com

Author: Cost Based Oracle: Fundamentals
http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
joel garry  
View profile  
 More options Feb 6 2008, 6:09 pm
Newsgroups: comp.databases.oracle.server
From: joel garry <joel-ga...@home.com>
Date: Wed, 6 Feb 2008 15:09:52 -0800 (PST)
Local: Wed, Feb 6 2008 6:09 pm
Subject: Re: long running select min(timestamp) query
On Feb 2, 3:01 am, "Jonathan Lewis" <jonat...@jlcomp.demon.co.uk>
wrote:

And now I see Richard has published some more details about coalesce
in his Feb 5 and 6 blogs:  http://richardfoote.wordpress.com/

jg
--
@home.com is bogus.
"Bravery is being the only one who knows you're afraid." - David
Hackworth


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages < Older 
« Back to Discussions « Newer topic     Older topic »