Posts

Showing posts with the label PostgreSQL9.6

PostgreSQL Foreign Data Wrappers

Hi all, I would like to mention about generating Foreign Data Wrappers(FDW) on PostgreSQL 9.6. FDW is used for remote access to tables from external data storage. If needed to use remote table in a query, you can use FDW tables. For instance you can get a table from remote database, but there is a condition. The condition is that user should have proper privileges on FDW table. There is two extension for FDW on PostgreSQL. First one is used for accessing PostgreSQL database to PostgreSQL database, called postgres_fdw . Second one is used for accessing PostgreSQL database to different databases (SQL Server, Sysbase) called tds_fdw .  Foreign Data Wrappers feature lets you to cross-query between remote database tables. Postgres_fdw and tds_fdw has different structure. Tds_fdw usign Tabular Data Stream application layer protocol to transfer data between database server and client. Generating Tds_fdw and Postgres_fdw is similar. I share an example for generating FDW between two Po

PostgreSQL'de Parolası Encrypt Edilmemiş Kullanıcılar için Authentication Düzenlemesi

Merhaba, PostgreSQL'de authentication ayarlarını pg_hba.conf dosyası içinde yapıyoruz. Pg_hba.conf dosyasına ait detaylı bilgiye buradan ulaşabilirsiniz. Pg_hba.conf içinde authentication method olarak password kullanılmışsa bunun anlamı kullanıcı parolası network üzerinden plaintext olarak aktarıldığıdır. Eğer böyle bir durumda authentication method değiştirmek istenirse izlenecek adım; Belirli bir kullanıcı için authentication method password kullanılmış ise o kullanıcının parolasının encrypt olup olmadığından pg_authid tablosuna bakılarak emin olunmalı. Eğer kullanıcı parolası encrypt edilmemişse(pg_authid tablosunda rolpassword alanına bakılmalı) o kullanıcı için ALTER ROLE .. WITH ENCRYPTED PASSWORD 'kullanıcı_parolası'; denilmeli. Kullanıcı parolası encrypted olarak saklandığına göre pg_hba.conf dosyasında password yerine 9.6 ve öncesi için en azından md5 yazılmalı. 10 ve sonrası için md5 veya scram-sha-256 kullanılabilir. (scram-sha-256, md5'ten daha g

How To Partitioning on PostgreSQL 9.6

Hello, I'm gonna share my experience on partitioning and show how affect partition on scripts. I'm gonna show you how to partitioning on existing table. Let's begin to following steps; Create new table. It's gonna be partitioned table. Create partition tables. Grant privileges to partition tables and partitioned table. Generate function and trigger on partitioned table. Insert data from main table to partitioned table. Create indexes if you had on main table on partition tables. Check partition tables everything is fine. Rename main table. Rename partitioned table name like main table Drop old main table. Not that: if you have some indexes or constraint on your main table, not to increase inserting time you should create your new main table and other partition tables without constraints and indexes. After insert whole data to partition tables you can add indexes and constraints. It will be help you to executing insert statement more quickly.  Bef