19 features you will miss if you leave oracle database · 3. in-place update oracle minimizes the...

29
19 features you will miss if you leave Oracle Database The demos are on YouTube: https://youtu.be/SI6qUNv-hT8 1 1

Upload: others

Post on 16-Sep-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

19 features you will miss

if you leave Oracle DatabaseThe demos are on YouTube:

https://youtu.be/SI6qUNv-hT8

1

1

Page 2: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

Page 2

Franck Pachot

Principal Consultant

Database Evangelist

+41 78 921 07 48

[email protected] @franckpachot

2

Page 3: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

The Company>Founded in 2010

>More than 70 specialists

>Specialized in the Middleware Infrastructure

> The invisible part of IT

>Customers in Switzerland and all over Europe

Our Offer>Consulting

>Service Level Agreements (SLA)

>Trainings

>License Management

Page 3

dbi services was founded in 2010 and is now a well-established Swiss SME with offices in Delémont Basel, Bern, Nyon and Zurich. Our customers are mainly based in Switzerland, but we also work for companies established all over Europe. We are over 70 employees and we specialize in the middleware infrastructure, which we call “the invisible part of IT”. This means that we can design, develop and manage every layer that is placed between the Hardware and the Software. Our offer includes Consulting, SLAs, Trainings and License management services in various technologies.

Since its beginnings, dbi services seeks for excellence, whether it concerns its employee’s expertise, its internal processes or the company itself as an employer.

I’ve been working for dbi services since 20XX and what I like most as an employee is (give your personal opinion, for example): - The opportunity to gain expertise and to enhance my knowledge through continuous training and certifications- The way our c-managers lead the company (they listen to the employees and keep promises)- The company’s strong culture that is driven by its values

3

Page 4: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

- Etc.

In 2019, dbi services is awarded 1st place in the “Best Workplaces Switzerland 2019” award. This clearly demonstrates that it is a great place to work.

3

Page 5: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

Agenda1. lock-free SELECT

2. fast load INSERT

3. in-place UPDATE

4. index only access

5. no need to reorg

6. cursor sharing

7. partitioning

8. optimizer features enable

9. hints

10. crash/media recovery

11. RMAN

12. My Oracle Support

13. wait Events

14. upgrade and migration

15. multiplatform

16. materialized views

17. flashback

18. Data Guard

19. … many more

Page 4

1. lock-free SELECT2. fast load INSERT3. in-place UPDATE4. index only access5. no need to reorg6. cursor sharing7. partitioning8. optimizer features enable9. hints10. crash/media recovery11. RMAN12. My Oracle Support13. wait Events14. upgrade and migration15. multiplatform16. materialized views17. flashback

4

Page 6: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

Why this presentation?

Page 5

I like Oracle technology, and also Open Source alternatives

However, the shout-out is not always fair:

- new features in PostgreSQL, MySQL,MariaDB,… are advertised a lot

- features that appeared in Oracle7are not so exiting for marketing in 2019but still critical for business

Today, the choice of the database technology is in the hands of the developers, and Open Source alternatives look appealing. Many talks and papers show the growing features of MySQL or PostgreSQL, which competes with the commercial RDBMS. But do not forget the core features that are there for decades. They may not be there, or less efficient, in those alternative solutions. Let’s show those basic features, with

5

Page 7: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

demos: in-place updates, cursor sharing, guaranteed disk writes, advanced materialized views, IOT, wait events, online operations,… Many were already in Oracle 30 years ago and we take them for granted. We may not realize what we will miss when going to another RDBMS.

From R. OCarroll to All Panelists: 03:18 PMMongoDb was in AWS deprecated 2019

5

Page 8: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

1. Lock-free SELECT

You can read

consistent data (no dirty read)

without any lock acquired

from any point in time

Page 6

You can readconsistent data (no dirty read) without any lock acquiredfrom any point in time

current committed datarecent version within UNDO_RETENTIONpast modification within FLASHBACK DATA ARCHIVE policy

No need to replicate, snapshot, archive, add timestamps with triggers,… for reads, reporting, exports,…

Think about doing an export, counting rows, testing queries,…

6

Page 9: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

2. Direct-Path INSERT

Fast load

For DWH, migrations, reorganization, IoT ingestion

Page 7

Fast load to append rows at the end of a table (or partition)writes pre-built blocksminimal UNDO, minimal REDOno buffer cache overheadno space management overheadno row-by-row index maintenance

For DWH load, migrations, reorganization,… or simply IoT ingestion

7

Page 10: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

3. In-place UPDATE

Oracle minimizes the row movement:

MVCC is at block level, with separate undo

Page 8

That looks simple, but PostgreSQL do not update rowsupdates are implemented as delete + insertwhich copies the whole row even if you update 1 byteand has to maintain all indexes because the row has movedand must come back to clean the old stuff after MVCC retention

Oracle minimizes the row movement:only when absolutely necessary (not enough space in the block)keeps a pointer to avoid index maintenancethis is critical for OLTP (like update flag='Y' where flag='N')

https://dbfiddle.uk/?rdbms=oracle_18&fiddle=b021258ba9887c12d3a40afb40d40339https://dbfiddle.uk/?rdbms=postgres_11&fiddle=18167a83488d29873d718be97c1275e4https://dbfiddle.uk/?rdbms=mariadb_10.2&fiddle=ab596af66802ba8d518dd4bacc40dca8

create table DEMO (id number,flag char,description varchar2(100))create unique index DEMO_ID on DEMO(id);

8

Page 11: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

insert into DEMO select rownum,'N',lpad('x',100) from xmltable('1 to 10000')select segment_name,dbms_xplan.format_size(sum(bytes)) from user_segmentswhere segment_name='DEMO' group by segment_name;update DEMO set flag='Y';select segment_name,dbms_xplan.format_size(sum(bytes)) from user_segmentswhere segment_name='DEMO' group by segment_name;alter table DEMO move online;select segment_name,dbms_xplan.format_size(sum(bytes)) from user_segmentswhere segment_name='DEMO' group by segment_name;

create table DEMO (id numeric,flag char,description text)create unique index DEMO_ID on DEMO(id);insert into DEMO select generate_series,'N',lpad('x',100) from generate_series(1,10000)select relname,pg_size_pretty(pg_total_relation_size(relid)) from pg_stat_user_tables where schemaname = current_schemaupdate DEMO set flag='Y';select relname,pg_size_pretty(pg_total_relation_size(relid)) from pg_stat_user_tables where schemaname = current_schemavacuum full DEMO;select relname,pg_size_pretty(pg_total_relation_size(relid)) from pg_stat_user_tables where schemaname = current_schema

create table DEMO (id numeric,flag char,description text)create unique index DEMO_ID on DEMO(id);insert into DEMO select seq,'N',lpad('x',100,' ') from seq_1_to_10000;commit;analyze table DEMO;select table_name,table_type,(data_length+index_length)/1024 'KB' from information_schema.tables where table_schema = database()update DEMO set flag='Y';commit;analyze table DEMO;select table_name,table_type,(data_length+index_length)/1024 'KB' from information_schema.tables where table_schema = database()

8

Page 12: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

4. Index-Only access

Page 9

Full Table Scan is good to get for lot of rowsTable access by index ROWID is good for few rows

In-between, Oracle has a very efficient access:Index Access without the need to go to the table

https://medium.com/@FranckPachot/index-only-access-with-oracle-mysql-postgresql-and-microsoft-sql-server-302383103998

9

Page 13: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

5. No need to reorg

Oracle maintains the physical structures for optimal query

no need to vacuum, reorg, rebuild,…

Page 10

Oracle maintains the physical structures for optimal querywith no dead tuples to vacuumwith no visibility map to refreshwith no unbalanced indexesscattered in heap by default, clustered if needed

This is important for the predictability of performance:no degradation over time

I've seen a table with 1 million extents

10

Page 14: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

6. Cursor sharing

MySQL, PostgreSQL,… each session compiles before executing

Oracle, SQL Server, DB2,… parse/compile/optimize once

Page 11

Oracle, like many commercial databasesparse/compile/optimize the statements onceexecute the optimized plan for different sessions, on different values,…

MySQL, PostgreSQL,…do not share the prepared statements across sessions

Compilation is CPU intensive, no cursor sharing limits the scalability and the possibility of advanced optimizer transformations

11

Page 15: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

7. PartitioningPartition pruning

Partition-wise joins

Global indexes

Partition exchange

Automatic creation of partitions (list, interval)

Referential partitioning

Thousands of partitions is not a problem.

Completely transparent (like a table)

Page 12

Storing a logical table into multiple physical one is just one step(partition views in Oracle7). Partitioning features are:

Partition pruningPartition-wise joinsGlobal indexesPartition exchangeAutomatic creation of partitions (list, interval)Referential partitioningThousands of partitions is not a problem.Completely transparent (like a table)

Oracle and MySQL with InnoDB

12

Page 16: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

8. optimizer_features_enable

A key feature for regression troubleshooting during upgrades:

run the optimizer at any version/fix level

Page 13

You can run the optimizer at any of these versions:

19.1.0.1, 19.1.0, 18.1.0, 12.2.0.1, 12.1.0.2, 12.1.0.1, 11.2.0.4, 11.2.0.3, 11.2.0.2, 11.2.0.1, 11.1.0.7, 11.1.0.6, 10.2.0.5, 10.2.0.4, 10.2.0.3, 10.2.0.2, 10.2.0.1, 10.1.0.5, 10.1.0.4, 10.1.0.3, 10.1.0, 9.2.0.8, 9.2.0, 9.0.1, 9.0.0, 8.1.7, 8.1.6, 8.1.5, 8.1.4, 8.1.3, 8.1.0, 8.0.7, 8.0.6, 8.0.5, 8.0.4, 8.0.3, 8.0.0 this sets flags for all changes in the last 20 years CBO code+ any intermediate fixes with "_fix_control"

This is key for regression troubleshooting in case of upgrade

13

Page 17: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

9. Hints

Full control for troubleshooting

SQL Plan Stability with SPM

Page 14

Hints can apply any parameter at statement level, can prevent some bad plans, can correct some optimizer estimations

Full control for troubleshootingBase feature for SQL Plan Management

→ SQL Plan Stability

From Georgi D. Sotirov to Everyone: 03:45 PMMySQL has hints since version 5.7.7 from 5 years ago and they were constantly improved since then.

14

Page 18: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

10. Crash and media recovery

When the Oracle server crashes…

I re-start and no worry if there are no specific errors

Page 15

When the server crashes…Oracle:

re-start and no worry if there are no specific errorsMany other databases:

better verify for corruption

Did you hear about postgres fsync() and non-direct reads?Which database can detect lost writes before it is too late

15

Page 19: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

11. RMAN

Recovery Manager

optimization

catalog

recovery advisor

Page 16

Recovery MANageroptimizes backups (read only tablespaces, block verification)manages retention (recovery window, fast recovery area)

and fully manages the recovery:catalog: knows exactly which files are requiredrecovery advisor for the most common cases

availability is always the priority

From R. OCarroll to All Panelists: 03:48 PMrman list_failure is good on SIDB, not on RAC / DG .it's good to see it is available in PDBs though.

16

Page 20: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

12. My Oracle Support

Maybe not the SR management

But the Knowledge Base

Page 17

… any doubt about the quality of the support?

How many time a search in the Knowledge Base provided you a solution, workaround or patch?

How many pages do you have to read to get relevant informationvs Stack Overflowvs Mailing Lists

The SR process is long for one customer but the KB result saves time to many customers

From ALEXANDRE MARTI to All Panelists: 03:51 PMAbout MOS, I agree with you, but Oracle could use a Google device to have a better search engine ;)

17

Page 21: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

13. Wait events DB time

Oracle is one of the best instrumented software

Tkprof, Statspack/AWR, ASH, SQL real-time Monitoring…

wait events with count and time waited

Page 18

Oracle is one of the best instrumented softwareall system calls are timed, with their context -> wait eventsmany operations increase statistics countersimplemented on decades of troubleshooting

in many platforms, many applications, many workloads

No equivalent. Tracing at OS level doesn't have the context

Tkprof, Statspack/AWR, ASH, SQL real-time Monitoring…

18

Page 22: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

14. Upgrade and Migrations

Predictable downtime

You can also migrate with small downtime

auto-upgrade, datapatch

transportable tablespace

Page 19

You can upgrade 100TB database in few hoursno need to move data, only the dictionary is touched, and all dictionary info stays (statistics)

You can also migrate with small downtimeeven cross-endiannesstransportable tablespacechange charactersetencrypt only

19

Page 23: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

15. Multi-platform

Application runs

on any cloud provider

on any endianness

on any relevant OS

Page 20

Which database can you runon any cloud provideron any endiannesson any relevant OS

without any change in your application?

20

Page 24: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

16. Materialized views

Incrementally updated (Fast refresh)

Always fresh (On-Commit and 18c real-time)

Transparent optimization (query rewrite)

dependencies and transaction consistency (refresh group)

Page 21

It is not only a table that stores the result from a view

Incrementally updated (Fast refresh)Always fresh (On-Commit and 18c real-time)Transparent optimization (query rewrite)Refresh Group: dependencies and transaction consistency

21

Page 25: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

17. Flashback, FDA, LogMiner

restore a dropped table (flashback table)

revert a failed application release (flashback database)

see recently delete rows (flashback query)

version for years without any trigger (Flashback Data Archive)

find exactly what changed, or locked, in the past (log miner)

Page 22

You don't need them everyday, but they can save your job:restore a dropped table (flashback table)revert a failed application release (flashback database)see recently delete rows (flashback query)version for years without any trigger (Flashback Data Archive)find exactly what changed, or locked, in the past (log miner)…

22

Page 26: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

18. Data Guard

Data Guard

fully automated DR (FSFO)

transparent application failover

snapshot standby

Page 23

A physical standby is the best protection:copies all data with minimal overheadon a completely different system (vs. storage synchronization which copies also the corrupt blocks)

Data Guardfully automated DR (FSFO)transparent application failover

23

Page 27: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

19…• Online operations to save your week-ends

• Parallel Query to scale on multi-core processors

• Data Pump to copy, migrate, archive, convert,…

• Audit without any additional development

• VPD to secure and isolate data without changing the code

• CMAN to have a single network address with HA and DR

• PL/SQL, EBR, APEX… to rapidly build efficient applications

• DRCP so scale the many micro-service connection pools

• JSON support for new data with same performance and reliability

Page 24

I like Online operations to save my weekends, and DRCP to cope with those microservicesPL/SQL … too much to say. that's for another session

• Online operations to save your week-ends• Parallel Query to scale on multi-core processors• Data Pump to copy, migrate, archive, convert,…• Audit without any additional development• VPD to secure and isolate data without changing the code• CMAN to have a single network address with HA and DR• PL/SQL, EBR, APEX… to rapidly build efficient applications• DRCP so scale the many micro-service connection pools• JSON support for new data with same performance and reliability

24

Page 28: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

Now, the 'lock-in' question:

Should-we avoid those features as we may move to Open Source in the future?

Today, you pay for Oracle, so:use what saves you time and money nowbe prepared for a move (evaluate cost)

Page 25

Often heard:" We may move out of Oracle in the future, then we avoid to use

Oracle specific features as we don't want to be locked-in"

Today, you pay for Oracle, so:you should use the features that saves you time and money todayif/when you move out (in years), you may find the equivalent feature

But: be sure to isolate all specifics in dedicated modules.

25

Page 29: 19 features you will miss if you leave Oracle Database · 3. In-place UPDATE Oracle minimizes the row movement: MVCC is at block level, with separate undo Page 8 That looks simple,

Core message

Do not stop at title when comparing features

Do not stop at popular buzz

Do not stop at development features

Page 26

When comparing RDBMS alternatives, look at all features.

having similar SQL functions doesn't mean it has the same featuresthe most important feature may not be the most popular buzzduring its lifecycle the database will have to get through:

data movement, troubleshooting, crash recovery, high concurrent activity

If the management thinks it is easy to move to non-Oracle alternatives, try to estimate the cost (skills, time, price) for all of them.

26