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.

42 lines
4.3KB

  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>13.6. Locking and Indexes</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="mvcc-caveats.html" title="13.5. Caveats" /><link rel="next" href="performance-tips.html" title="Chapter 14. Performance Tips" /></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">13.6. Locking and Indexes</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="mvcc-caveats.html" title="13.5. Caveats">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="mvcc.html" title="Chapter 13. Concurrency Control">Up</a></td><th width="60%" align="center">Chapter 13. Concurrency Control</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="performance-tips.html" title="Chapter 14. Performance Tips">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="LOCKING-INDEXES"><div class="titlepage"><div><div><h2 class="title" style="clear: both">13.6. Locking and Indexes</h2></div></div></div><a id="id-1.5.12.9.2" class="indexterm"></a><p>
  3. Though <span class="productname">PostgreSQL</span>
  4. provides nonblocking read/write access to table
  5. data, nonblocking read/write access is not currently offered for every
  6. index access method implemented
  7. in <span class="productname">PostgreSQL</span>.
  8. The various index types are handled as follows:
  9. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
  10. B-tree, <acronym class="acronym">GiST</acronym> and <acronym class="acronym">SP-GiST</acronym> indexes
  11. </span></dt><dd><p>
  12. Short-term share/exclusive page-level locks are used for
  13. read/write access. Locks are released immediately after each
  14. index row is fetched or inserted. These index types provide
  15. the highest concurrency without deadlock conditions.
  16. </p></dd><dt><span class="term">
  17. Hash indexes
  18. </span></dt><dd><p>
  19. Share/exclusive hash-bucket-level locks are used for read/write
  20. access. Locks are released after the whole bucket is processed.
  21. Bucket-level locks provide better concurrency than index-level
  22. ones, but deadlock is possible since the locks are held longer
  23. than one index operation.
  24. </p></dd><dt><span class="term">
  25. <acronym class="acronym">GIN</acronym> indexes
  26. </span></dt><dd><p>
  27. Short-term share/exclusive page-level locks are used for
  28. read/write access. Locks are released immediately after each
  29. index row is fetched or inserted. But note that insertion of a
  30. GIN-indexed value usually produces several index key insertions
  31. per row, so GIN might do substantial work for a single value's
  32. insertion.
  33. </p></dd></dl></div><p>
  34. </p><p>
  35. Currently, B-tree indexes offer the best performance for concurrent
  36. applications; since they also have more features than hash
  37. indexes, they are the recommended index type for concurrent
  38. applications that need to index scalar data. When dealing with
  39. non-scalar data, B-trees are not useful, and GiST, SP-GiST or GIN
  40. indexes should be used instead.
  41. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="mvcc-caveats.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="mvcc.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="performance-tips.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">13.5. Caveats </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 14. Performance Tips</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1