Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PostgreSQL and SQL:2023 - Property Graph Querie...

Koji Annoura
November 24, 2023

PostgreSQL and SQL:2023 - Property Graph Queries の話題と各RDBの実装

PostgreSQL Conference Japan 2023の発表資料です。

【A1】PostgreSQL and SQL:2023 - Property Graph Queries の話題と各RDBの実装

SQL:2023では、Part 16: Property Graph Queries (SQL/PGQ)が追加されました。 Oracle Database 23c には既に実装され、PostgreSQLでは将来の機能となっています。 他のRDBも実装が始まっています。それぞれ、実装はどう違っているのでしょうか? RDBに追加された問い合わせ言語 SQL/PGQ と 2024年にリリースされるグラフデータベース用のGQL はどこが異なっているのでしょうか? 最新の話題をお伝えします。

Koji Annoura

November 24, 2023
Tweet

More Decks by Koji Annoura

Other Decks in Programming

Transcript

  1. 8IPBN* ⿣ *MPWF ⿣ /FPK(SBQI%BUBCBTF ⿣ /FPK6TFST(SPVQ5PLZP ⿣ *BNPOFPGUIFGPVOEFST ⿣

    (SBQI$PNNVOJUZ.71 ⿣ "QBDIF)PQ ⿣ %BUB0SDIFTUSBUJPO"QQ ⿣ "QBDIF6TFS(SPVQ+BQBO ⿣ *BNBGPVOEFS
  2. 42-1(2 ⿣ 1SPQFSUZ(SBQI2VFSZ ⿣ IUUQTXXXJTPPSHTUBOEBSEIUNM ⿣ 42- *40*&$  ⿣

    1BSU ⿣ (FOFSBMJOGPSNBUJPO ⿣ 4UBUVT  1VCMJTIFE ⿣ 1VCMJDBUJPOEBUF   ⿣ 4UBHF*OUFSOBUJPOBM4UBOEBSEQVCMJTIFE ⿣ &EJUJPO   ⿣ /VNCFSPGQBHFT   ⿣ 5FDIOJDBM$PNNJUUFF *40*&$+5$4$ 4PVSDF*40 IUUQTXXXJTPPSHTUBOEBSEIUNM
  3. 42-1(2BOE(2- ⿣ 42-1(2 ⿣ 42-JODMVEFT 1SPQFSUZ(SBQI2VFSZ ⿣ 0SBDMF%BUBCBTFD ⿣ (2-

    ⿣ *OUFSOBUJPOBM4UBOEBSE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