5. مقدمه
●
هایت رابط و گرا شی اطلاعاتی بانکORDBMS
–(اها نقش ، بری)جدول ارث
CREATE TABLE cities (name text, population real,altitude int);
Create type state as
( state_code int, state_name varchar(2));
CREATE TABLE capitals (state state ) INHERITS (cities);
insert into capitals values ('mashhad',300,1,(1,'KH'));
select * from only cities;
داده نوع یک جدول اهر
6. پستگرس انشعابات
● PostgreSQL Advanced Plus : like oracle.
● Netezza : a popular database choice for data warehousing.
● Tpostgres : with tPostgres, you use the packaged pgtsql language
extension to write functions that use T-SQL
● BigSQL : is a marriage of the two elephants: PostgreSQL and Hadoop
with Hive.BigSQL comes packaged with hadoop_fdw , an FDW for querying
and updating Hadoop data sources.
● Postgres-XL : built-in Massively Parallel Processing (MPP) capability
and data sharding across servers.
8. پستگرس ساختار
● Service : More than one service can run on a physical server as long as
they listen on different ports and don’t share data storage.
● Database : Default database is postgres.
● Schema : immediate next level of organization within each
database,Default Schema is Public,everything you create into public by
default unless you change the search_path of the database.
● Catalog : system schemas that store PostgreSQL built-in functions and
meta-data .pg_catalog , which has all the functions, tables, system views,
casts, and types packaged with PostgreSQL; and information_schema ,
which consists of ANSI standard views that expose PostgreSQL
metainformation in a format dictated by the ANSI SQL standard.
9. پستگرس ساختار
● Variable : search_path,work_mem,superuser_reserved_connections… : SHOW ALL
● Extension : per database , like add-ons,postgis , procedural
languages(plv8,python,perl)
● Table
– foreign table and foreign data wrapper: like database links ,
link to Mssql server , Oracle , Mysql , CSV , Webservice like Twitter.
● Tablespace:A tablespace is the physical location where data is stored
● View : materialized views like Oracle.
● Function : same as stored ptocedures in other database engines.
● Language : three base procedural languages :SQL,PL/pgSQL, and C,other
languages can install : Python, JavaScript, Perl, and R
10. پستگرس ساختار
● Operator
● Data type : array … , Custom DataType
● Cast : custom cast.
● Sequence : like oracle sequence,PostgresSQL automatically creates
sequences when you define a serial column.
● Row
● Trigger:In version 9.1, a data change in a view can fire a trigger. In
version 9.3, data definition language (DDL) events can fire triggers.
● Rule
16. اطلاعاتی بانک مدیریت
●
مسیر در : کانفیگ لهایه فای
Cent OS : /var/lib/pgsql/9.3/data
Ubuntu 15.04 : /etc/postgresql/9.3/main
● Postgresql.conf : IP , Port , Memory, Log.
● pg_hba.conf : Controls security. It manages access to the server,
dictating which users can log in to which databases, which IP addresses or
groups of addresses can connect, and which authentication scheme to
expect.
● pg_ident.conf : maps an authenticated OS login to a PostgreSQL user.
17. اطلاعاتی بانک مدیریت
: کانفیگ فایلهای مسیر آوردن بدست
SELECT name, setting FROM pg_settings WHERE category = 'File Locations';
: کانفیگ فایل در ها متغییر برخی مقدار آوردن بدست
SELECT name, context , unit ,setting, boot_val, reset_val
FROM pg_settings
WHERE name IN ( 'listen_addresses', 'max_connections', 'shared_buffers',
'effective_cache_size', 'work_mem', 'maintenance_work_mem')
ORDER BY context, name;
Show max_connections;
Show all;
21. گروهی شهایه نقGroup Roles
●
قابلیت گروهی شهایه نقloginاز گروهی دربردارنده بعنوان و ندارند
.دارند کاربرد ها مجوز
CREATE ROLE students INHERIT;
any member of royalty will automatically have rights granted to the royalty role
GRANT students TO studentuser1;
GRANT students TO studentuser2;
24. DATABASE SCHEMA
● Schemas organize your database into logical groups
– Default schema is public.
– object names must be unique within a schema.
– Same name in different schemas.
– search_path = "$user", public in postgresql.conf
– GRANT ALL ON ALL TABLES IN SCHEMA public TO
mydb_admin WITH GRANT OPTION;
– GRANT SELECT, REFERENCES, TRIGGER ON ALL TABLES IN
SCHEMA my_schema TO PUBLIC;
– Backup & restore on schema.