Home » RDBMS Server » Performance Tuning » Compressing indexes that have a timestamp in first column.
Compressing indexes that have a timestamp in first column. [message #181818] Tue, 11 July 2006 13:55 Go to next message
cajohn
Messages: 10
Registered: July 2006
Junior Member
I am looking for some clarification here.

I have been told two different answers and I am not sure which one to believe. Is their a benefit to compressing indexes for performance gains that start with a timestamp as the first column? I have been told that index compression only works on the first column and since timestamp is my first column that it would not do much compression so it would not change the performance. The other person said it would help performance even with very little compression gain. Who is right and why?

Thanks.

[Updated on: Tue, 11 July 2006 14:21]

Report message to a moderator

Re: Compressing indexes that have a timestamp in first column. [message #181846 is a reply to message #181818] Tue, 11 July 2006 22:06 Go to previous messageGo to next message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Compression works on a leading subset of columns in the index, you choose how many. You only get a benefit if there are many rows with the same leading subset. If (say) five rows have the same leading subset, then oracle stores that subset once, and then stores the values of the remaining columns separately for each row.

The benefit comes by reducing the average width of an index entry and packing more of them into a block. When you perform an index range scan, full index scan, or fast full scan, you read fewer blocks. Less IO means better performance.

Unique scans and "short" range scans (where the whole range of rows fits in a block anyway) will have no performance gain. These types of scans read 1 block whether or not the index is compressed. Depending on your block size and column values, a block may contain from 1 to perhaps 100's of rows.

If you have dozens or hundreds of rows with EXACTLY the same timestamp (down to the second for DATE or fraction of second for TIMESTAMP data type), then compression MAY help if you regularly perform the types of index scans mentioned above.

Ross Leishman
Re: Compressing indexes that have a timestamp in first column. [message #182175 is a reply to message #181846] Thu, 13 July 2006 07:32 Go to previous messageGo to next message
cajohn
Messages: 10
Registered: July 2006
Junior Member
Thanks for the information. Your explanation was 100X's better then the way the past two people explained to me. This database receives feeds from different security devices and some have fractions of a second while others do not. Since most of the queries use fast or full index scan I will start utilizing compression on the indexes.
Re: Compressing indexes that have a timestamp in first column. [message #182235 is a reply to message #182175] Thu, 13 July 2006 21:36 Go to previous message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Try this:

ALTER INDEX ind_name REBUILD COMPUTE STATISTICS;

Check the USER_INDEXES.LEAF_BLOCKS

Drop and re-create the index with compression, analyze, and check the LEAF_BLOCKS again.

Ensure the reduction is leaf blocks is worth the effort.

Ross Leishman
Previous Topic: Performance Issue
Next Topic: Can we improve this qry.
Goto Forum:
  


Current Time: Sat Nov 23 12:56:55 CST 2024