Zulip 服务器和 Web 应用程序。开源团队聊天可帮助团队保持高效和专注。
Go to file
Alex Vandiver 102481bc47 migrations: Adjust stats size for tsvector to 10k, from 100.
PostgreSQL's `default_statistics_target` is used to track how many
"most common values" ("MCVs") for a column when performing an
`ANALYZE`.  For `tsvector` columns, the number of values is actually
10x this number, because each row contains multiple values for the
column[1].  The `default_statistics_target` defaults to 100[2], and
Zulip does not adjust this at the server level.

This translates to 1000 entries in the MCV for tsvectors. For
large tables like `zerver_messages`, a too-small value can cause
mis-planned query plans.  The query planner assumes that any
entry *not* found in the MCV list is *half* as likely as the
least-likely value in it.  If the table is large, and the MCV list is
too short (as 1000 values is for large deployments), arbitrary
no-in-the-MCV words will often be estimated by the query planner to
occur comparatively quite frequently in the index.  Based on this, the
planner will instead choose to scan all messages accessible by the
user, filtering by word in tsvector, instead of using the tsvector
index and filtering by being accessible to the user.  This results in
degraded performance for word searching.

However, PostgreSQL allows adjustment of this value on a per-column
basis.  Add a migration to adjust the value up to 10k for
`search_tsvector` on `zerver_message`, which results in 100k entries
in that MCV list.

PostgreSQL's documentation says[3]:

> Raising the limit might allow more accurate planner estimates to be
> made, particularly for columns with irregular data distributions, at
> the price of consuming more space in `pg_statistic` and slightly
> more time to compute the estimates.

These costs seem adequate for the utility of having better search.
In the event that the pgroonga backend is in use, these larger index
statistics are simply wasted space and `VACUUM` computational time,
but the costs are likely still reasonable -- even 100k values are
dwarfed by the size of the database needed to generate 100k unique
entries in tsvectors.

[1]: https://github.com/postgres/postgres/blob/REL_14_4/src/backend/utils/adt/array_typanalyze.c#L261-L267
[2]: https://www.postgresql.org/docs/14/runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET
[3]: https://www.postgresql.org/docs/14/planner-stats.html#id-1.5.13.5.3
2022-07-19 09:24:06 -07:00
.github ci: Test upgrades from the minimum of each major version, not the max. 2022-07-16 10:43:40 -07:00
.tx cleanup: Delete trailing newlines. 2019-08-06 23:29:11 -07:00
.vscode vscode: Recommend remote development extension. 2021-11-03 16:03:46 -07:00
analytics requirements: Upgrade to Django 4.0. 2022-07-13 16:07:17 -07:00
confirmation confirmation: Fix the type annotation of create_confirmation_link. 2022-06-29 11:31:07 -07:00
corporate corporate: Fix type annotations for payment failed handler. 2022-07-15 14:56:22 -07:00
docs ci: Test upgrades from the minimum of each major version, not the max. 2022-07-16 10:43:40 -07:00
frontend_tests settings_config: Remove stream-admins option for wildcard mention policy. 2022-07-13 17:07:44 -07:00
locale i18n: Update translation data from Transifex. 2022-07-14 16:22:29 -07:00
pgroonga typing: Use BaseDatabaseSchemaEditor in place of DatabaseSchemaEditor. 2022-05-30 14:18:53 -07:00
puppet teleport: Add explicit WebAuthn config, not just U2F. 2022-07-18 11:41:00 -07:00
requirements requirements: Upgrade to Django 4.0. 2022-07-13 16:07:17 -07:00
scripts requirements: Upgrade to Django 4.0. 2022-07-13 16:07:17 -07:00
static settings_profile_fields: Show confirmation modal when deleting option. 2022-07-15 16:51:24 -07:00
stubs/taint actions: Split out zerver.actions.message_send. 2022-04-14 17:14:34 -07:00
templates help center: Update /help/change-your-language. 2022-07-15 14:59:35 -07:00
tools ci: Remove references to CircleCI, which we no longer use. 2022-07-16 10:43:40 -07:00
var/puppeteer puppeteer_tests: Port to TypeScript. 2021-02-22 16:03:10 -08:00
zerver migrations: Adjust stats size for tsvector to 10k, from 100. 2022-07-19 09:24:06 -07:00
zilencer populate_db: Fix data for "Favorite editor" custom field. 2022-07-15 16:51:24 -07:00
zproject custom_profile: Apply ProfileDataElementUpdateDict. 2022-07-15 14:55:03 -07:00
.browserslistrc zjsunit: Set browserslist target to current Node for Node tests. 2022-05-04 09:56:07 -07:00
.codecov.yml codecov: Change threshold to use percentage syntax. 2019-07-20 14:37:04 -07:00
.codespellignore CI: Add Codespell linter. 2021-10-27 16:49:30 -07:00
.editorconfig editorconfig: Restore indent_size = 2 for Markdown. 2021-08-20 23:14:37 -07:00
.eslintignore requirements: Remove Thumbor. 2021-05-06 20:07:32 -07:00
.eslintrc.json dependencies: Upgrade JavaScript dependencies. 2022-07-06 17:23:16 -07:00
.gitattributes .gitattributes: Mark *.bmp, *.bson, *.mp3, *.pdf as binary. 2022-02-07 18:51:06 -08:00
.gitignore editor: Add .vscode/extensions.json file. 2021-10-29 15:47:44 -07:00
.gitlint lint: Re-enable imperative-mood checking. 2021-02-23 14:54:07 -08:00
.mailmap mailmap: Add entries to deduplicate more contributors. 2022-03-29 12:13:21 -07:00
.npmignore Add proxy notes to new README.dev.md troubleshooting section. 2016-03-29 21:54:05 -07:00
.prettierignore prettier: Exclude backend-processed Markdown files. 2021-08-20 23:14:37 -07:00
.pyre_configuration pysa: Update .pyre_configuration to point to typeshed. 2020-09-22 15:44:47 -07:00
.sonarcloud.properties tools: Configure Zulip to be scannable by SonarCloud. 2020-06-24 12:41:17 -07:00
.yarnrc .yarnrc: Set ignore-scripts true. 2019-08-28 16:15:54 -07:00
babel.config.js babel: Bump configured corejs version. 2022-07-07 21:12:31 -07:00
CODE_OF_CONDUCT.md docs: Apply bullet style changes from Prettier. 2021-09-08 12:06:24 -07:00
CONTRIBUTING.md docs: Link to new licensing page from main CONTRIBUTING page. 2022-07-07 14:06:34 -07:00
Dockerfile-postgresql docker: Document the PostgreSQL Dockerfile build steps. 2022-04-26 18:00:00 -07:00
LICENSE license: Move copyright notice from LICENSE to NOTICE. 2021-02-05 09:28:12 -08:00
manage.py manage: Remove ineffective Python 2 check. 2022-06-30 11:15:14 -07:00
NOTICE docs: Bump copyright year. 2021-02-05 09:28:15 -08:00
package.json babel: Bump configured corejs version. 2022-07-07 21:12:31 -07:00
postcss.config.js css: Replace "night-mode-block" with "dark-theme-block". 2021-11-26 22:03:29 -08:00
prettier.config.js prettier: Disable embedded language formatting for Markdown. 2021-08-20 23:14:37 -07:00
pyproject.toml mypy: Enable local_partial_types. 2022-07-06 17:33:13 -07:00
README.md docs: Update README and installation guide. 2022-03-04 13:59:17 -08:00
SECURITY.md SECURITY.md: Reorder and make clearer how to subscribe to announcements. 2022-01-07 15:56:26 -08:00
setup.cfg pycodestyle: Improve comments documenting excludes. 2021-02-12 13:11:25 -08:00
stylelint.config.js yarn: Add package which allows creating css mixins. 2021-12-09 18:15:18 -08:00
tsconfig.json tsconfig: Enable noImplicitOverride. 2021-09-13 10:10:34 -07:00
Vagrantfile Remove Debian 10 support. 2022-04-26 16:32:02 -07:00
version.py models: Remove "role" field from Subscription. 2022-07-13 17:07:44 -07:00
webpack.config.ts webpack: Remove LoaderOptionsPlugin. 2021-10-17 07:13:57 -07:00
yarn.lock babel: Bump configured corejs version. 2022-07-07 21:12:31 -07:00

Zulip overview

Zulip is an open-source team collaboration tool with unique topic-based threading that combines the best of email and chat to make remote work productive and delightful. Fortune 500 companies, leading open source projects, and thousands of other organizations use Zulip every day. Zulip is the only modern team chat app that is designed for both live and asynchronous conversations.

Zulip is built by a distributed community of developers from all around the world, with 74+ people who have each contributed 100+ commits. With over 1000 contributors merging over 500 commits a month, Zulip is the largest and fastest growing open source team chat project.

Come find us on the development community chat!

GitHub Actions build status coverage status Mypy coverage code style: black code style: prettier GitHub release docs Zulip chat Twitter GitHub Sponsors

Getting started

You may also be interested in reading our blog, and following us on Twitter and LinkedIn.

Zulip is distributed under the Apache 2.0 license.