Professional Documents
Culture Documents
A single logical table can be split into a number of physically separate pieces
based on ranges of key values. Each of the parts of the table is called a partition.
TYPES
Range partitions
List partitions
Hash partitions
ADVANTAGES
Example:
Hash partitioning
Hash partitioning is a partitioning technique where a hash key is used to
distribute rows evenly across the different partitions (sub-tables). This is
typically used where ranges aren't appropriate, i.e. employee number,
productID, etc.
create table emp2 (
empno number(4),
ename varchar2(30),
sal
number
)
partition by hash(empno) (
partition e1 tablespace emp1,
partition e2 tablespace emp2,
partition e3 tablespace emp3,
partition e4 tablespace emp4
);
Materialized View
A materialized view is a database object that contains the results of a query. It is also called
as snapshot.
When creating a materialized view, you have the option of specifying whether the refresh
occurs ON DEMAND or ON COMMIT. In the case of ON COMMIT, the materialized view is
changed every time a transaction commits, thus ensuring that the materialized view always
contains the latest data. Alternatively, you can control the time when refresh of the
materialized views occurs by specifying ON DEMAND. In the case of ON DEMAND
materialized views, the refresh can be performed with refresh methods provided in either
the DBMS_SYNC_REFRESH or the DBMS_MVIEW packages
ON COMMIT
ON DEMAND
create materialized view mv
REFRESH ON DEMAND
as select * from t
;
REFRESH MECHANISM
REFRESH COMPLETE
REFRESH FAST
OPERATIONS
On demand:- manual, schedule
On commit:- automatic
REFRESH FORCE (COMPLETE and FAST) --- but in case of fast materialized base table
should have mviewlog
PLSQL:
Basics :
What is a block and block structure (declaration, execution, exception )