本文介绍 django.db.models.Index.include 的用法。
声明
Index.include
Django 3.2 中的新函数。 
要作为非键列包含在覆盖索引中的字段名称的列表或元组。这允许 index-only 扫描用于仅选择包含字段 ( ) 并仅按索引字段 (include  ) 过滤的查询。fields 
例如:
Index(name='covering_index', fields=['headline'], include=['pub_date'])
将允许过滤 headline ,同时选择 pub_date ,同时仅从索引中获取数据。
使用include 将产生比使用多列索引更小的索引,但缺点是非键列不能用于排序或过滤。
include 对于 PostgreSQL 以外的数据库将被忽略。
使用 include 时需要   。Index.name 
有关 covering indexes 的更多详细信息,请参阅 PostgreSQL 文档。
PostgreSQL 的限制
PostgreSQL 11+ 只支持覆盖 B-Tree 索引,PostgreSQL 12+ 也支持覆盖   。GiST indexes 
相关用法
- Python Django Index.expressions用法及代码示例
 - Python Int转Bytes用法及代码示例
 - Python Django InlineModelAdmin.get_extra用法及代码示例
 - Python Django InlineModelAdmin.raw_id_fields用法及代码示例
 - Python InteractiveConsole runcode()用法及代码示例
 - Python InteractiveInterpreter runsource()用法及代码示例
 - Python InteractiveInterpreter runcode()用法及代码示例
 - Python IncrementalEncoder encode()用法及代码示例
 - Python Django InlineModelAdmin.get_max_num用法及代码示例
 - Python PIL Image.draft()用法及代码示例
 - Python PIL Image.thumbnail()用法及代码示例
 - Python PIL Image.new()用法及代码示例
 - Python PIL ImageOps.fit()用法及代码示例
 - Python Wand Image()用法及代码示例
 - Python PIL ImageDraw.Draw.rectangle()用法及代码示例
 - Python PIL ImageEnhance.Color() and ImageEnhance.Contrast()用法及代码示例
 - Python Itertools.zip_longest()用法及代码示例
 - Python PIL Image.getdata()用法及代码示例
 - Python Itertools.compress()用法及代码示例
 - Python PIL ImageFont.truetype()用法及代码示例
 - Python Itertools.count()用法及代码示例
 - Python PIL ImagePath.Path.tolist()用法及代码示例
 - Python PIL Image.transform()用法及代码示例
 - Python PIL Image.quantize()用法及代码示例
 - Python PIL Image.point()用法及代码示例
 
注:本文由纯净天空筛选整理自djangoproject.com大神的英文原创作品 django.db.models.Index.include。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
