Vacuum ● Records deleted or obsoloted by an update are not reclaimed as free space and cannot be reused ● Vacuum claims that space for the system to reuse,

Slides:



Advertisements
Similar presentations
Big Data Working with Terabytes in SQL Server Andrew Novick
Advertisements

FlareCo Ltd ALTER DATABASE AdventureWorks SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS Slide 1.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Keith Burns Microsoft UK Mission Critical Database.
Backup The flip side of recovery. Types of Failures Transaction failure –Transaction must be aborted System failure –Hardware or software problem resulting.
Harvard University Oracle Database Administration Session 2 System Level.
Page 1JSOC Review – 17 March 2005 Database Maintenance Karen Tian
Backup and Recovery Part 1.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Oracle9i Database Administrator: Implementation and Administration
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Agenda  Overview  Configuring the database for basic Backup and Recovery  Backing up your database  Restore and Recovery Operations  Managing your.
National Manager Database Services
Transaction log grows unexpectedly
Oracle backup and recovery strategy
© 2009 IBM Corporation Information Management Informix Dynamic Server Continuous Availability Feature (CAF) Ron Privett KC IIUG Tech Day - 01/22/2009.
Introduction to Oracle Backup and Recovery
70-293: MCSE Guide to Planning a Microsoft Windows Server 2003 Network, Enhanced Chapter 14: Problem Recovery.
Backup & Recovery 1.
Building Highly Available Systems with SQL Server™ 2005 Vineet Gupta Evangelist – Data and Integration Microsoft Corp.
Implementing Database Snapshot & Database Mirroring in SQL Server 2005 Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP Microsoft.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
5 Copyright © 2004, Oracle. All rights reserved. Using Recovery Manager.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
Chapter 8 Implementing Disaster Recovery and High Availability Hands-On Virtual Computing.
1 Moshe Shadmon ScaleDB Scaling MySQL in the Cloud.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
7202ICT – Database Administration
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Daniela Anzellotti Alessandro De Salvo Barbara Martelli Lorenzo Rinaldi.
1 Chapter 14 DML Tuning. 2 DML Performance Fundamentals DML Performance is affected by: – Efficiency of WHERE clause – Amount of index maintenance – Referential.
Partitioning Design For Performance and Maintainability Martin Cairns
Backup and Recovery Overview Supinfo Oracle Lab. 6.
Module 16: Performing Ongoing Database Maintenance
Publish / Subscribe Database Log Shipping over Bittorent P2P CS 848 Fall 2006 Univeristy of Waterloo Project Presentation by N. T c h e r v e n s k i.
Lecture 12 Recoverability and failure. 2 Optimistic Techniques Based on assumption that conflict is rare and more efficient to let transactions proceed.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
Week 7 : Chapter 7 Agenda SQL 710 Maintenance Plan:
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
High Availability in DB2 Nishant Sinha
3 Copyright © 2006, Oracle. All rights reserved. Using Recovery Manager.
IT System Administration Lesson 3 Dr Jeffrey A Robinson.
Visual Basic for Application - Microsoft Access 2003 Finishing the application.
Database technology Introduction ER Modeling Database objects (intro) SQL.
18 Copyright © 2004, Oracle. All rights reserved. Backup and Recovery Concepts.
18 Copyright © 2004, Oracle. All rights reserved. Recovery Concepts.
POSTGRESQL 13 TH MARCH HISTORY DESIGNED BY MICHAEL STONEBRAKER ( ANDREW YU, JOLLY CHEN) AT UCLA (1999) COMMUNITY DEVELOPED 15 YEARS ACTIVE DEVELOPMENT.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
6 Copyright © Oracle Corporation, All rights reserved. Backup and Recovery Overview.
20 Copyright © 2006, Oracle. All rights reserved. Best Practices and Operational Considerations.
7.5 Using Stored-Procedure and Triggers NAME MATRIC NUM GROUP Muhammad Azwan Bin Khairul Anwar CS2305A Muhammad Faiz Bin Badrol Shah CS2305B.
DBMS ● What are they? ● Why used ● Examples? – Oracle – Access – MySQL – Postgres – SQLServer – Sqlite.
Copyright 2009 EnterpriseDB Corporation. All rights Reserved. Slide: 1 PostgreSQL 9.0 Streaming Replication under the hood Heikki Linnakangas.
Partitioning & Creating Hardware Tablespaces for Performance

Database structure and space Management
Maximum Availability Architecture Enterprise Technology Centre.
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Designing Database Solutions for SQL Server
MDEV Cross-Engine SQL Backup
Introduction of Week 6 Assignment Discussion
Informix Dynamic Server Continuous Availability Feature (CAF)
Oracle9i Database Administrator: Implementation and Administration
Workshop.
Chapter 11 Managing Databases with SQL Server 2000
Presentation transcript:

Vacuum ● Records deleted or obsoloted by an update are not reclaimed as free space and cannot be reused ● Vacuum claims that space for the system to reuse, but does not reclaim the space ● No lock, can be done in production ● Vacuum full actually reclaims the space ● Gets an exclusive lock, not production ● But backup / restore seems a more efficient procedure than vacuum full

Partitioning ● What is it? ● Splitting one large logical table into various small physical tables ● What for? ● Certain queries can be optimized – various smaller indexes – full scans only on subtables ● Operations on a whole partition are efficient and easy – droping a whole partition – copying it to another media ● Seldom used data can be put into cheaper or slower tablespaces

Partitioning ● Needed? ● Our dCache instance has an ever-growing database that is interesting to keep: BillingDB ● At PIC, it is around 14 Gb, and doorinfo by itself is more than 8 Gb. That's only for ● We use Brian Bockleman's GraphTool package to do some nice plots, and would like to keep that information available.

Partitioning: Implementation ● Create a master table ● This table will contain no data, have no checks, and no indexes CREATE TABLE doorinfo ( datestamp timestamp without time zone, (discrimination field) cellname character varying, "action" character varying, "owner" character varying, (index) mappeduid numeric, mappedgid numeric, client character varying, "transaction" character varying, (index) pnfsid character varying, connectiontime numeric, queuedtime numeric, errorcode numeric, errormessage character varying, path character varying );

Partitioning: Implementation ● Create several child tables, that each inherit from the master table. Each of these tables is refered as partition create table doorinfo_y2007 ( ) inherits (doorinfo); create table doorinfo_y2008 ( ) inherits (doorinfo); create table doorinfo_y2009 ( ) inherits (doorinfo); create table doorinfo_y2010 ( ) inherits (doorinfo);

Partitioning: Implementation ● Add table constraints to define the allowed keys in each partition create table doorinfo_y2008 ( check (timestamp >= DATA ' ' AND timestamp < DATE ' ') ) inherits (doorinfo); create table doorinfo_y2009 ( check (timestamp >= DATA ' ' AND timestamp < DATE ' ') ) inherits (doorinfo); create table doorinfo_y2010 ( check (timestamp >= DATA ' ' AND timestamp < DATE ' ') ) inherits (doorinfo); create table doorinfo_y2011 ( check (timestamp >= DATA ' ' AND timestamp < DATE ' ') ) inherits (doorinfo);

Partitioning: Implementation ● Create indexes on the key columns if needed – We have two indexes on doorinfo, owner and transaction create index doorinfo_y2007_owner on doorinfo_y2007 (owner); create index doorinfo_y2007_transaction on doorinfo_y2007 (transaction); create index doorinfo_y2008_owner on doorinfo_y2008 (owner); create index doorinfo_y2008_transaction on doorinfo_y2008 (transaction);

Partitioning: Implementation ● Define a trigger to redirect data inserted into the master table create or replace function doorinfo_insert_trigger() returns trigger as $$ begin insert into doorinfo_y2009 values (new.*); return null; end; $$ language plpgsql; create trigger insert_doorinfo_trigger before insert on doorinfo for each row execute procedure doorinfo_insert_trigger(); ● With this approach, we will need to update the function each year

Partitioning: Implementation ● You can define a more complicated trigger that automatically selects the correct partition create or replace function doorinfo_insert_trigger() return trigger as $$ begin if (new.datestamp >= DATE ' ' and new.logdate = DATE ' ' and 'new.logdate < DATE ' ') then insert into doorinfo_y2008 values (new.*); else raise exception 'date out of range'; end if; return null; end; $$ language plpgsql;

Partitioning: Notes ● Ensure that the constraint_exclusion parameter is enabled in postgresql.conf ● Constraint exclusion ● Query optimization technique ● Allows planner to scan only one child table instead of all the tables if a constant is used in the query select * from doorinfo where datestamp >= DATE ' ';

Partitioning: Notes ● No automatic way to verify the CHECK constraints ● VACUUM & ANALYZE commands have to be executed on the subtables as well ● Constraint exclusion ● Query optimization technique ● Allows planner to scan only one child table instead of all the tables

Partitioning: Notes ● To migrate a table to other media, you can use ALTER TABLE name SET TABLESPACE new_tablespace; ● That will not migrate indexes; move them by hand

Warm Standby ● What is it? ● It is a technique for being able to have an up-to-date database that mirrors de production database ● What it is for ● Up-to-the-minute (constant) backups of the database ● Fast recovery ● Involves playing with the WAL files

Warm Standby: Write Ahead Log ● Keeping logs of every change on the data pages ● Changes to data have to be written after they have been logged and the log is safe on disk ● This allows roll-forward / redo ● We can replay what happened before a crash ● This allows committing transactions without needing to flush data to disk ● Less I/O

Warm Standby: Write Ahead Log ● WAL files live in the pg_xlog directory ● Postgres uses WAL files if there is a crash in the postgres server process ● But those same WAL files can also be used for ● Continous Archiving (backups up to the minute) ● Point-in-time Recovery (time machine)

Warm Standby: Continous Archiving ● Setup a script that copies WAL files modifying some parameters in postgresql.conf ● archive_mode ● archive_command ● archive_timeout ● We can keep a backup of the file-system level database and the WAL files, and replay them as backup recovery procedure ● Simulating a crash – postgresql won't be able to tell the diference

Warm Standby: Continous Archiving ● We can also have a secondary server continously in crash-recovery mode recovering from WALs sent from the primary server ● also called file-based log shipping ● That means we will have a live backup of the data, with synchronization up to the minute ● If you also want non-live backups, you can backup from the secondary ● reduced load on the primary server

Warm Standby: Procedure ● Set up primary and standby systems as near identically as possible, including two identical copies of PostgreSQL at the same release level. ● Set up continuous archiving from the primary to a WAL archive located in a directory on the standby server.

Warm standby: Procedure ● Make a base backup of the primary server, and load this data onto the standby. ● Begin recovery on the standby server from the local WAL archive, using a recovery.conf that specifies a restore_command that is looping waiting for new WAL files to be shipped.

Warm standby ● This smells like High Availability, but it is not – it is Online Backup / Fast Recovery ● For high availability, we need the capability of do Failover ● This can be done ● Via an external tool, i.e., Heartbeat ● Through other aproaches, like Slony

Slony ● What is it? ● It is a master-slave replication system to replicate large databases to a reasonably limited number of slave systems ● Providing cascading and automatic failover ● External package not provided by postgres developers ● Can be installed by compiling from source code or via provided rpms

Slony: Concepts ● Master ● Node that can read and write the database ● Slave ● Node that can only read the database ● Subscription ● Nodes subscribe to a set of tables; master is the provider while slave are the subscriptors ● Is it based on record-based log shipping ● slaves have each modified record shipped to them so they have an almost identical copy of the master

Slony: Concepts ● New slony (2.0) only runs with Postgres 8.3 – Uses new features from 8.3

Backups vs Warm Standby vs Slony ● Backups: Disaster Recovery ● Downtime: reaction time + some hours ● Data loss: some hours ● can be lowered highly if you also archive WAL files ● Warm standby: Fast Recovery ● Downtime: reaction time + some minutes ● can be lowered with an automatic failover tool like heartbeat ● Data loss: up to 1 minute ● Slony: High Availability ● Downtime: reaction + some minutes ● Can be automated with failover – order of seconds (lag) ● Data loss: failover – some transactions