Using Table Partitioning Features in XPS to Solve Old Data Problem

Using Table Partitioning Features in XPS to Solve Old Data Problem

Question:
Do the table partitioning features (fragmenting) in XPS solve the problem of unloading old data in a data warehouse?Specifically, I need to delete up to 400MB of old data from one table and insert 400MB of new data. Can I avoid locking and logging overhead by dropping a fragment that contains data belonging to a particular date range? Is this more or less instantaneous, or does updating indexes still represent major overhead?

Answer:
Your question is not specifically XPS-oriented; the same principles apply to tables created in OnLine Dynamic Server instances. To start, let’s briefly review the options available to fragment tables.

Informix allows you to use two different methods of fragmentation: “by expression” and “round robin.” You can use these methods to fragment indexes as well as tables, although fragmenting an index using round robin fragmentation would be stupid to say the least. Each fragmentation method has its own strengths and weaknesses, which will make one method for fragmenting a table more appropriate than the other depending on the situation.

With round robin fragmentation, data is distributed serially across all of the table’s fragments. This method is equivalent to RAID level 0. The advantage (as well as disadvantage) to this fragmentation method is the same — in order to find a row in the table (provided an index does not exist to assist in the search), all fragments of the table must be scanned. This is usually done en masse and ties up the entire table. Since each disk has a small sub-segment of the table, hopefully the search will not take that long to complete but that time can only be measured against the time required to scan the entire table on one drive. The problem with this method (and RAID level 0 in particular) is that all fragments need to be searched for each query. As a result, a table can only service one request at a time.

By expression fragmentation allows you to define the conditions by which data is distributed among available drives in the system. This allows you to set the conditions that will, by default, speed up queries, and also allows you to create historical tables. How to write the fragmentation expressions are not covered here, but you can use almost any column (or combination of columns) in the table as the foundation in the fragmentation expression.

The primary advantage to by expression fragmentation from a query optimization point of view is that the Informix Query Optimizer will use the fragmentation logic to refine the query path through the table. If a query’s conditions, and the table’s fragmentation scheme, are such that only a couple of the total number of table fragments could possibly have the data requested, only those fragments will be searched. This allows a table to service multiple requests, provided the requests don’t all require data from the same fragments.

I usually recommend against using serial or date-related columns in fragmentation expressions unless your intent is to create historical tables. These types of columns make it very easy to “detach” a fragment from the original table and create a historical table with data for a known time frame or numerical range. Of course this new table can be dropped if the data it contains is no longer needed.

As far as overhead costs are concerned, detaching fragments are much lighter than executing an SQL delete command. When a fragment is detached, the only thing it carries with it from the original table is the data the fragment contained and extent sizing information. All index and index-based constraint information (primary or foreign keys) as well as column level constraints (not null, check constraints) are dropped as well. There is very little reshuffling of data pages required, although there is some work executed within the index pages of the original table to drop all references to data no longer in the table. While the total workload is minimal, I recommend locking the table in exclusive mode prior to detaching the fragment to avoid the possibility of running into a lock overflow condition.

The process of detaching a fragment completes very quickly. A new fragment can then be attached to the original table with the table’s fragmentation expression altered to reflect the range of data it is to contain.

To reduce overhead when extracting data by dropping a fragment, drop all indexes on the table prior to detaching the fragment. Once the fragment is dropped, you can re-create the indexes and flatten out the B+ tree structure. You indexes will work better after you do this.

devx-admin

devx-admin

Share the Post:
5G Innovations

GPU-Accelerated 5G in Japan

NTT DOCOMO, a global telecommunications giant, is set to break new ground in the industry as it prepares to launch a GPU-accelerated 5G network in

AI Ethics

AI Journalism: Balancing Integrity and Innovation

An op-ed, produced using Microsoft’s Bing Chat AI software, recently appeared in the St. Louis Post-Dispatch, discussing the potential concerns surrounding the employment of artificial

Savings Extravaganza

Big Deal Days Extravaganza

The highly awaited Big Deal Days event for October 2023 is nearly here, scheduled for the 10th and 11th. Similar to the previous year, this

5G Innovations

GPU-Accelerated 5G in Japan

NTT DOCOMO, a global telecommunications giant, is set to break new ground in the industry as it prepares to launch a GPU-accelerated 5G network in Japan. This innovative approach will

AI Ethics

AI Journalism: Balancing Integrity and Innovation

An op-ed, produced using Microsoft’s Bing Chat AI software, recently appeared in the St. Louis Post-Dispatch, discussing the potential concerns surrounding the employment of artificial intelligence (AI) in journalism. These

Savings Extravaganza

Big Deal Days Extravaganza

The highly awaited Big Deal Days event for October 2023 is nearly here, scheduled for the 10th and 11th. Similar to the previous year, this autumn sale has already created

Cisco Splunk Deal

Cisco Splunk Deal Sparks Tech Acquisition Frenzy

Cisco’s recent massive purchase of Splunk, an AI-powered cybersecurity firm, for $28 billion signals a potential boost in tech deals after a year of subdued mergers and acquisitions in the

Iran Drone Expansion

Iran’s Jet-Propelled Drone Reshapes Power Balance

Iran has recently unveiled a jet-propelled variant of its Shahed series drone, marking a significant advancement in the nation’s drone technology. The new drone is poised to reshape the regional

Solar Geoengineering

Did the Overshoot Commission Shoot Down Geoengineering?

The Overshoot Commission has recently released a comprehensive report that discusses the controversial topic of Solar Geoengineering, also known as Solar Radiation Modification (SRM). The Commission’s primary objective is to

Remote Learning

Revolutionizing Remote Learning for Success

School districts are preparing to reveal a substantial technological upgrade designed to significantly improve remote learning experiences for both educators and students amid the ongoing pandemic. This major investment, which

Revolutionary SABERS Transforming

SABERS Batteries Transforming Industries

Scientists John Connell and Yi Lin from NASA’s Solid-state Architecture Batteries for Enhanced Rechargeability and Safety (SABERS) project are working on experimental solid-state battery packs that could dramatically change the

Build a Website

How Much Does It Cost to Build a Website?

Are you wondering how much it costs to build a website? The approximated cost is based on several factors, including which add-ons and platforms you choose. For example, a self-hosted

Battery Investments

Battery Startups Attract Billion-Dollar Investments

In recent times, battery startups have experienced a significant boost in investments, with three businesses obtaining over $1 billion in funding within the last month. French company Verkor amassed $2.1

Copilot Revolution

Microsoft Copilot: A Suit of AI Features

Microsoft’s latest offering, Microsoft Copilot, aims to revolutionize the way we interact with technology. By integrating various AI capabilities, this all-in-one tool provides users with an improved experience that not

AI Girlfriend Craze

AI Girlfriend Craze Threatens Relationships

The surge in virtual AI girlfriends’ popularity is playing a role in the escalating issue of loneliness among young males, and this could have serious repercussions for America’s future. A

AIOps Innovations

Senser is Changing AIOps

Senser, an AIOps platform based in Tel Aviv, has introduced its groundbreaking AI-powered observability solution to support developers and operations teams in promptly pinpointing the root causes of service disruptions

Bebop Charging Stations

Check Out The New Bebob Battery Charging Stations

Bebob has introduced new 4- and 8-channel battery charging stations primarily aimed at rental companies, providing a convenient solution for clients with a large quantity of batteries. These wall-mountable and

Malyasian Networks

Malaysia’s Dual 5G Network Growth

On Wednesday, Malaysia’s Prime Minister Anwar Ibrahim announced the country’s plan to implement a dual 5G network strategy. This move is designed to achieve a more equitable incorporation of both

Advanced Drones Race

Pentagon’s Bold Race for Advanced Drones

The Pentagon has recently unveiled its ambitious strategy to acquire thousands of sophisticated drones within the next two years. This decision comes in response to Russia’s rapid utilization of airborne

Important Updates

You Need to See the New Microsoft Updates

Microsoft has recently announced a series of new features and updates across their applications, including Outlook, Microsoft Teams, and SharePoint. These new developments are centered around improving user experience, streamlining

Price Wars

Inside Hyundai and Kia’s Price Wars

South Korean automakers Hyundai and Kia are cutting the prices on a number of their electric vehicles (EVs) in response to growing price competition within the South Korean market. Many

Solar Frenzy Surprises

Solar Subsidy in Germany Causes Frenzy

In a shocking turn of events, the German national KfW bank was forced to discontinue its home solar power subsidy program for charging electric vehicles (EVs) after just one day,

Electric Spare

Electric Cars Ditch Spare Tires for Efficiency

Ira Newlander from West Los Angeles is thinking about trading in his old Ford Explorer for a contemporary hybrid or electric vehicle. However, he has observed that the majority of

Solar Geoengineering Impacts

Unraveling Solar Geoengineering’s Hidden Impacts

As we continue to face the repercussions of climate change, scientists and experts seek innovative ways to mitigate its impacts. Solar geoengineering (SG), a technique involving the distribution of aerosols

Razer Discount

Unbelievable Razer Blade 17 Discount

On September 24, 2023, it was reported that Razer, a popular brand in the premium gaming laptop industry, is offering an exceptional deal on their Razer Blade 17 model. Typically

Innovation Ignition

New Fintech Innovation Ignites Change

The fintech sector continues to attract substantial interest, as demonstrated by a dedicated fintech stage at a recent event featuring panel discussions and informal conversations with industry professionals. The gathering,

Import Easing

Easing Import Rules for Big Tech

India has chosen to ease its proposed restrictions on imports of laptops, tablets, and other IT hardware, allowing manufacturers like Apple Inc., HP Inc., and Dell Technologies Inc. more time