gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
6.4KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>31.1. What Is JIT compilation?</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="jit.html" title="Chapter 31. Just-in-Time Compilation (JIT)" /><link rel="next" href="jit-decision.html" title="31.2. When to JIT?" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">31.1. What Is <acronym xmlns="http://www.w3.org/1999/xhtml" class="acronym">JIT</acronym> compilation?</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="jit.html" title="Chapter 31. Just-in-Time Compilation (JIT)">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="jit.html" title="Chapter 31. Just-in-Time Compilation (JIT)">Up</a></td><th width="60%" align="center">Chapter 31. Just-in-Time Compilation (<acronym xmlns="http://www.w3.org/1999/xhtml" class="acronym">JIT</acronym>)</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="jit-decision.html" title="31.2. When to JIT?">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="JIT-REASON"><div class="titlepage"><div><div><h2 class="title" style="clear: both">31.1. What Is <acronym class="acronym">JIT</acronym> compilation?</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="jit-reason.html#JIT-ACCELERATED-OPERATIONS">31.1.1. <acronym class="acronym">JIT</acronym> Accelerated Operations</a></span></dt><dt><span class="sect2"><a href="jit-reason.html#JIT-INLINING">31.1.2. Inlining</a></span></dt><dt><span class="sect2"><a href="jit-reason.html#JIT-OPTIMIZATION">31.1.3. Optimization</a></span></dt></dl></div><p>
  3. Just-in-Time (<acronym class="acronym">JIT</acronym>) compilation is the process of turning
  4. some form of interpreted program evaluation into a native program, and
  5. doing so at run time.
  6. For example, instead of using general-purpose code that can evaluate
  7. arbitrary SQL expressions to evaluate a particular SQL predicate
  8. like <code class="literal">WHERE a.col = 3</code>, it is possible to generate a
  9. function that is specific to that expression and can be natively executed
  10. by the CPU, yielding a speedup.
  11. </p><p>
  12. <span class="productname">PostgreSQL</span> has builtin support to perform
  13. <acronym class="acronym">JIT</acronym> compilation using <a class="ulink" href="https://llvm.org/" target="_top"><span class="productname">LLVM</span></a> when
  14. <span class="productname">PostgreSQL</span> is built with
  15. <a class="link" href="install-procedure.html#CONFIGURE-WITH-LLVM"><code class="literal">--with-llvm</code></a>.
  16. </p><p>
  17. See <code class="filename">src/backend/jit/README</code> for further details.
  18. </p><div class="sect2" id="JIT-ACCELERATED-OPERATIONS"><div class="titlepage"><div><div><h3 class="title">31.1.1. <acronym class="acronym">JIT</acronym> Accelerated Operations</h3></div></div></div><p>
  19. Currently <span class="productname">PostgreSQL</span>'s <acronym class="acronym">JIT</acronym>
  20. implementation has support for accelerating expression evaluation and
  21. tuple deforming. Several other operations could be accelerated in the
  22. future.
  23. </p><p>
  24. Expression evaluation is used to evaluate <code class="literal">WHERE</code>
  25. clauses, target lists, aggregates and projections. It can be accelerated
  26. by generating code specific to each case.
  27. </p><p>
  28. Tuple deforming is the process of transforming an on-disk tuple (see <a class="xref" href="storage-page-layout.html#STORAGE-TUPLE-LAYOUT" title="68.6.1. Table Row Layout">Section 68.6.1</a>) into its in-memory representation.
  29. It can be accelerated by creating a function specific to the table layout
  30. and the number of columns to be extracted.
  31. </p></div><div class="sect2" id="JIT-INLINING"><div class="titlepage"><div><div><h3 class="title">31.1.2. Inlining</h3></div></div></div><p>
  32. <span class="productname">PostgreSQL</span> is very extensible and allows new
  33. data types, functions, operators and other database objects to be defined;
  34. see <a class="xref" href="extend.html" title="Chapter 37. Extending SQL">Chapter 37</a>. In fact the built-in objects are implemented
  35. using nearly the same mechanisms. This extensibility implies some
  36. overhead, for example due to function calls (see <a class="xref" href="xfunc.html" title="37.3. User-Defined Functions">Section 37.3</a>).
  37. To reduce that overhead, <acronym class="acronym">JIT</acronym> compilation can inline the
  38. bodies of small functions into the expressions using them. That allows a
  39. significant percentage of the overhead to be optimized away.
  40. </p></div><div class="sect2" id="JIT-OPTIMIZATION"><div class="titlepage"><div><div><h3 class="title">31.1.3. Optimization</h3></div></div></div><p>
  41. <span class="productname">LLVM</span> has support for optimizing generated
  42. code. Some of the optimizations are cheap enough to be performed whenever
  43. <acronym class="acronym">JIT</acronym> is used, while others are only beneficial for
  44. longer-running queries.
  45. See <a class="ulink" href="https://llvm.org/docs/Passes.html#transform-passes" target="_top">https://llvm.org/docs/Passes.html#transform-passes</a> for
  46. more details about optimizations.
  47. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="jit.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="jit.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="jit-decision.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 31. Just-in-Time Compilation (<acronym class="acronym">JIT</acronym>) </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 31.2. When to <acronym class="acronym">JIT</acronym>?</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1