• Home
  • Services
    • DBA Support
    • DBA Consultancy Services
    • PostgreSQL Support
    • Website Maintenance
  • Courses

    About Courses

    • List Of Courses
    • Become an Instructor
    Greenplum Database

    Greenplum Database

    $2,000.00 $1,500.00
    Read More
  • Company
    • FAQs
    • About Us
    • Contact
  • Events
  • Portfolio
  • Blogs
    • Blog – RayaFeeL
    • Blog – PostgreSQL Support
    • Blog – PostgreSQL Migration
    • Blog – All DB’s
    • Blog – Linux
    • Blog – Medical Coding
      • Cart

        0

    Have any question?
    (+91)8838953252
    ITsupport@rayafeel.com
    RegisterLogin
    RayaFeeL
    • Home
    • Services
      • DBA Support
      • DBA Consultancy Services
      • PostgreSQL Support
      • Website Maintenance
    • Courses

      About Courses

      • List Of Courses
      • Become an Instructor
      Greenplum Database

      Greenplum Database

      $2,000.00 $1,500.00
      Read More
    • Company
      • FAQs
      • About Us
      • Contact
    • Events
    • Portfolio
    • Blogs
      • Blog – RayaFeeL
      • Blog – PostgreSQL Support
      • Blog – PostgreSQL Migration
      • Blog – All DB’s
      • Blog – Linux
      • Blog – Medical Coding
        • Cart

          0

      Databases

      • Home
      • All courses
      • Databases
      • Greenplum Database
      CoursesIT & SoftwareDatabasesGreenplum Database
      • Greenplum Tutorial
        9
        • Lecture1.1
          Download the Greenplum Sandbox VM 30 min
        • Lecture1.2
          Greenplum Database Architecture 30 min
        • Lecture1.3
          Greenplum Configuration Files ( pg_hba.conf , postgresql.conf ) 30 min
        • Lecture1.4
          Greenplum Database Installation 30 min
        • Lecture1.5
          Greenplum psql Command Line Client 30 min
        • Lecture1.6
          Greenplum Create Users and Roles 30 min
        • Lecture1.7
          Greenplum Create and Prepare Database 30 min
        • Lecture1.8
          Greenplum Create Tables 30 min
        • Lecture1.9
          Greenplum Data Loading 30 min
      • Greenplum Performance Tuning
        7
        • Lecture2.1
          Greenplum Performance Tuning Overview 30 min
        • Lecture2.2
          Greenplum Analyze the tables 30 min
        • Lecture2.3
          Greenplum explain plans 30 min
        • Lecture2.4
          Greenplum Indexes and performance 30 min
        • Lecture2.5
          Greenplum Row vs. column orientation 30 min
        • Lecture2.6
          Greenplum – Check for even data distribution on segments 30 min
        • Lecture2.7
          Greenplum Partitioning 30 min
      • Greenplum Database Analytics
        1
        • Lecture3.1
          Greenplum Database analytics 30 min
      • Greenplum Backup and Recovery Operations
        2
        • Lecture4.1
          Greenplum gpcrondump 30 min
        • Lecture4.2
          Greenplum gpdbrestore 30 min
      • Importing GPDB Sandbox
        1
        • Lecture5.1
          Importing GPDB Sandbox into VMware Fusion 30 min
      • Greenplum Database Books
        1
        • Lecture6.1
          Data Warehousing with Greenplum PDF 30 min
      • Basic Questions and Answer of Greenplum Database
        1
        • Lecture7.1
          Some basic Questions and answer about Greenplum database 30 min

        Greenplum Row vs. column orientation

        Greenplum Database offers the ability to store a table in either row or column orientation. Both storage options have advantages, depending upon data compression characteristics, the kinds of queries executed, the row length, and the complexity and number of join columns.

        As a general rule, very wide tables are better stored in row orientation, especially if there are joins on many columns. Column orientation works well to save space with compression and to reduce I/O when there is much duplicated data in columns.

        In this exercise, you will create a column-oriented version of the fact table and compare it with the row-oriented version.

        1. Create a column-oriented version of the FAA On Time Performance fact table and insert the data from the row-oriented version.
          tutorial=# CREATE TABLE FAA.OTP_C (LIKE faa.otp_r) WITH (appendonly=true,
          orientation=column)
          DISTRIBUTED BY (UniqueCarrier, FlightNum) PARTITION BY RANGE(FlightDate)
          ( PARTITION mth START('2009-06-01'::date) END ('2010-10-31'::date)
          EVERY ('1 mon'::interval));
          tutorial=# INSERT INTO faa.otp_c SELECT * FROM faa.otp_r;
        2. Compare the definitions of the row and the column versions of the table.
          tutorial=# \d faa.otp_r
          
                            Table "faa.otp_r"
                  Column        |       Type       | Modifiers
          ----------------------+------------------+-----------
           flt_year             | smallint         |
           flt_quarter          | smallint         |
           flt_month            | smallint         |
           flt_dayofmonth       | smallint         |
           flt_dayofweek        | smallint         |
           flightdate           | date             |
           uniquecarrier        | text             |
           airlineid            | integer          |
           carrier              | text             |
           flightnum            | text             |
           origin               | text             |
           origincityname       | text             |
           originstate          | text             |
           originstatename      | text             |
           dest                 | text             |
           destcityname         | text             |
           deststate            | text             |
           deststatename        | text             |
           crsdeptime           | text             |
           deptime              | integer          |
           depdelay             | double precision |
           depdelayminutes      | double precision |
           departuredelaygroups | smallint         |
           taxiout              | smallint         |
           wheelsoff            | text             |
           wheelson             | text             |
           taxiin               | smallint         |
           crsarrtime           | text             |
           arrtime              | text             |
           arrdelay             | double precision |
           arrdelayminutes      | double precision |
           arrivaldelaygroups   | smallint         |
           cancelled            | smallint         |
           cancellationcode     | text             |
           diverted             | smallint         |
           crselapsedtime       | integer          |
           actualelapsedtime    | double precision |
           airtime              | double precision |
           flights              | smallint         |
           distance             | double precision |
           distancegroup        | smallint         |
           carrierdelay         | smallint         |
           weatherdelay         | smallint         |
           nasdelay             | smallint         |
           securitydelay        | smallint         |
           lateaircraftdelay    | smallint         |
          Distributed by: (uniquecarrier, flightnum)

          Notice that the column-oriented version is append-only and partitioned. It has seventeen child files for the partitions, one for each month from June 2009 through October 2010.

        3. tutorial=# \d faa.otp_c
          
                 Append-Only Columnar Table "faa.otp_c"
                  Column        |       Type       | Modifiers
          ----------------------+------------------+-----------
           flt_year             | smallint         |
           flt_quarter          | smallint         |
           flt_month            | smallint         |
           flt_dayofmonth       | smallint         |
           flt_dayofweek        | smallint         |
           flightdate           | date             |
           uniquecarrier        | text             |
           airlineid            | integer          |
           carrier              | text             |
           flightnum            | text             |
           origin               | text             |
           origincityname       | text             |
           originstate          | text             |
           originstatename      | text             |
           dest                 | text             |
           destcityname         | text             |
           deststate            | text             |
           deststatename        | text             |
           crsdeptime           | text             |
           deptime              | integer          |
           depdelay             | double precision |
           depdelayminutes      | double precision |
           departuredelaygroups | smallint         |
           taxiout              | smallint         |
           wheelsoff            | text             |
           wheelson             | text             |
           taxiin               | smallint         |
           crsarrtime           | text             |
           arrtime              | text             |
           arrdelay             | double precision |
           arrdelayminutes      | double precision |
           arrivaldelaygroups   | smallint         |
           cancelled            | smallint         |
           cancellationcode     | text             |
           diverted             | smallint         |
           crselapsedtime       | integer          |
           actualelapsedtime    | double precision |
           airtime              | double precision |
           flights              | smallint         |
           distance             | double precision |
           distancegroup        | smallint         |
           carrierdelay         | smallint         |
           weatherdelay         | smallint         |
           nasdelay             | smallint         |
           securitydelay        | smallint         |
           lateaircraftdelay    | smallint         |
          Checksum: t
          Number of child tables: 17 (Use \d+ to list them.)
          Distributed by: (uniquecarrier, flightnum)
        4. Compare the sizes of the tables using the pg_relation_size() and pg_total_relation_size() functions. The pg_size_pretty() function converts the size in bytes to human-readable units.

          tutorial=# SELECT pg_size_pretty(pg_relation_size('faa.otp_r'));
          pg_size_pretty
          ----------------
           256 MB
          (1 row)
          
          tutorial=# SELECT pg_size_pretty(pg_total_relation_size('faa.otp_r'));
           pg_size_pretty
          ----------------
           256 MB
          (1 row)
          
          tutorial=# SELECT pg_size_pretty(pg_relation_size('faa.otp_c'));
          
           pg_size_pretty
          ----------------
           0 bytes
          (1 row)
          
          tutorial=# SELECT pg_size_pretty(pg_total_relation_size('faa.otp_c'));
          
           pg_size_pretty
          ----------------
           288 kB
          (1 row)

        Prev Greenplum Indexes and performance
        Next Greenplum – Check for even data distribution on segments

        ADVERTISEMENT

        Latest Courses

        PostgreSQL Database

        PostgreSQL Database

        $600.00 $500.00
        Greenplum Database

        Greenplum Database

        $2,000.00 $1,500.00

        Preview Course

        Free

        Latest Posts

        PostgreSQL Patching version 9, 10,11
        10Oct2019
        Tools for PostgreSQL
        16Sep2019
        Postgres user creation and restrict DDL & database access
        13Sep2019

        Recent Forum Topics

        • thought behind whiteboard activity
        • Are you going to take your first ste
        • How to start working on an application?
        • please let me know pre requirements to increase work_mem
        • how to copy some data in one table to another table in postgres

        2ndquadrant.in

        (+91) 8838953252

        ITsupport@rayafeel.com

        Company

        • About Us
        • Contact
        • Our Team
        • Blog

        COURSES

        • List Of Course
        • Become An Instructor
        • Events
        • Postgres Support Blog

        Support

        • DBA Support
        • Consultancy Services
        • Postgres Migration Blogs
        • Forum

        Recommend

        • Groups
        • Login
        • FAQs
        • SignUp

        IT Services by rayafeel.com. Powered by Rayafeel Technologies Pvt Ltd.

        • Privacy
        • Terms

        Become An Instructor?

        Join thousand of instructors and earn money hassle free!

        Get Started Now

        Login with:

        Login with Google Login with Twitter Login with LinkedIn Login with Microsoft

        Login with your site account

        Lost your password?

        Not a member yet? Register now

        Register a new account

        Are you a member? Login now

        Modal title

        Message modal