Советы для начинающих разработчиков PostgreSQL

  • Published on
    23-Jan-2017

  • View
    395

  • Download
    3

Embed Size (px)

Transcript

  • www.postgrespro.ru

    POSTGRESQL

    a.lubennikova@postgrespro.ru

  • 2

    PostgreSQL

    ( Proposal Commit')

  • 3

    PostgreSQL

    -

    *

  • 4

    PostgreSQL

    ( Proposal Commit')

  • 5

  • 6

    PostgreSQL

    The PostgreSQL Global Development Group (PGDG) core team commiters ()

    (Major) contributors - (Postgres

    Professional, EnterpriseDB, 2ndQuadrant, Cybertec...)

  • 7

    Open source

    PostgreSQL License

    BSD PostgreSQL

    Github

    DBA,

    https://github.com/postgres/postgreshttp://www.postgresql.org/docs/9.5/static/index.html

  • 8

    PGCon ( ) PGConf.eu ( ) PGConf.ru ( )

    PGConf PGDay ( ) #PostgreSQLRussia Meetup (

    ) Postgres Professional

    https://www.pgcon.org/2015/http://2015.pgconf.eu/http://pgconf.ru/http://www.postgresql.org/about/events/http://www.meetup.com/postgresqlrussia/

  • 9

    Mailing lists ( )

    pgsql-hackers

    pgsql-bugs pgsql-general pgsql-perfomance pgsql-novice ...

    http://www.postgresql.org/list/

  • 10

    PROPOSAL, WIP (Work In Progress), POC (Proof Of Concept), PATCH

  • 11

    ,

    Hi,hackers!

    Blablabla.

    AnastasiaLubennikova

    PostgresProfessional:http://www.postgrespro.com

    TheRussianPostgresCompany

  • 12

    A:Becauseitreversesthelogicalflowofconversation.Q:Whyistoppostingfrownedupon?A:Topposting.Q:Whatisthemostannoyingthingonusenetandinemail?

  • 13

    Commitfests ( ) Feature Freeze ( ) Alpha- Beta- ( ) PostgreSQL

    ( )

    https://commitfest.postgresql.org/

  • 14

    Commitfests

    Reviewers Reviewer

    Github

  • 15

    ?

    Feature Matrix Wiki PostgreSQL PostgreSQL README

    http://www.postgresql.org/docs/9.5/static/index.htmlhttp://www.postgresql.org/about/featurematrix/http://postgresql.nabble.com/PostgreSQL-f1843779.subapps.htmlhttps://wiki.postgresql.org/wiki/Main_Pagehttp://planet.postgresql.org/http://www.postgresql.org/docs/books/

  • 16

    PostgreSQL

    ( Proposal Commit')

  • 17

    Proposal ()

  • 18

    ? TODO? hackers? ? README

  • 19

    Proposal

    , use case

    , :

    hackers

  • 20

    - =(

    !

  • 21

    regression tests concurrency tests

    Code style

  • 22

  • 23

    Gdb selectpg_backend_pid();

    pg_backend_pid

    5140

    (1row)

    gdbp5140

    Logfile

  • 24

    elogelog(LOG,Servermsg);

    elog(NOTICE,Clientexpectedmsg);

    elog(WARNING,Clientunexpectedmsg);

    elog(ERROR,Aborttransaction);

    print.c, outfuncs.c Assert

    Assert(some_ptr!=NULL);

    http://doxygen.postgresql.org/elog_8h_source.htmlhttp://doxygen.postgresql.org/backend_2nodes_2print_8c.htmlhttp://doxygen.postgresql.org/outfuncs_8c.html

  • 25

    Regression tests

    Regression tests makecheck

    visrc/test/regress/regression.diffs

    src/test/regress/sql/new.sql

    src/test/regress/expected/new.out

    src/test/regress/serial_schedule

    src/test/regress/parallel_schedule

    http://www.postgresql.org/docs/devel/static/regress.html

  • 26

    Pgbench

    pgbench

    http://www.postgresql.org/docs/devel/static/pgbench.html

  • 27

    Buildfarm

    PostgreSQL Buildfarm

    https://wiki.postgresql.org/wiki/PostgreSQL_Buildfarm_Howto

  • 28

    Dataset

    Sample Databases

    random();

    generate_series(start,stop,step);

    CREATETABLEtest(idinteger,bbox);

    INSERTINTOtest

    (SELECTx,point(random(),random())

    FROMgenerate_series(1,10)asx);

    https://wiki.postgresql.org/wiki/Sample_Databaseshttp://www.postgresql.org/docs/devel/static/functions-srf.html

  • 29

    postgresql.conf SHOWconfig_file;

    SHOWALL;

    select*frompg_settings;

    \? \timing

    \x

    http://www.postgresql.org/docs/devel/static/runtime-config.html

  • 30

    Planner configuration SETenable_indexscan=false;

    SETenable_mergejoin=false;

    EXPLAIN explain(analyze,buffers)tablet;

    explain(analyze,verbose)tablet;

    explain(analyze,formatxml)tablet;

    http://www.postgresql.org/docs/devel/static/runtime-config-query.htmlhttp://www.postgresql.org/docs/devel/static/sql-explain.html

  • 31

    Code style

    Tab' Tab-size = 4 {}

  • 32

    Code style

    /*

    *(\___/)*(='.'=) *(")_(")*

    */

    src/tools/pgindent

  • 33

    ,

    README

  • 34

    hackers.

  • 35

    PostgreSQL

    ( Proposal Commit')

  • 36

    Git

    Working with Gitgitclonegit://git.postgresql.org/git/postgresql.git

    cdpostgresql

    gitbranchmy_branch

    gitcheckoutmy_branch

    $EDITOR

    gitadd

    gitcommita

    gitdiffpatiencemastermy_branch|

    filterdiffformat=context>../mycoolfeature.patch

    https://wiki.postgresql.org/wiki/Working_with_Git

  • 37

    Git

    Git

    gitlogS'vacuum'

    http://habrahabr.ru/post/174467/http://eax.me/git-commands/

  • 38

    IDE /

    Vim. Filestyle Emacs. src/tools/editors Sublime Text. Trailing Spaces KDevelop Eclipse Doxygen*

    * web-

    https://github.com/aserebryakov/filestylehttps://github.com/SublimeText/TrailingSpaceshttp://doxygen.postgresql.org/index.html

  • 39

    ./configure

    Installation ProcedureCFLAGS='O0' CFLAGS='O2'

    ./configure

    prefix=$WORKSPACE_PATH/postgres_bin/

    enabledebug

    enablecassert

    enabledepend

    http://www.postgresql.org/docs/9.5/static/install-procedure.html

  • 40

    PATH=$WORKSPACE_PATH/postgres_bin/bin

    LD_LIBRARY_PATH=

    $WORKSPACE_PATH/postgres_bin/lib

    PGDATA=$WORKSPACE_PATH/postgres_data

  • 41

    make

    makej4 makeinstall makeclean makedistclean

  • 42

    Installation guide./configure//

    makej4

    makecheck //

    su

    #makeinstall

    #adduserpostgres

    #mkdir$WORKSPACE_PATH/postgres_data

    #chownpostgres$WORKSPACE_PATH/postgres_data

    http://www.postgresql.org/docs/9.5/static/installation.html

  • 43

    initdbD$WORKSPACE_PATH/postgres_data

    pg_ctlD$WORKSPACE_PATH/postgres_data

    llogfilestart

    createdbtest

    psqltest

  • 44

    ...

    : System Catalogs Node, Oid, Datum, Relation

  • www.postgrespro.ru

    ! ?

    a.lubennikova@postgrespro.ru

    1 2 . 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

Recommended

View more >