@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD}) public @interface QuerySqlField { /**
* Specifies whether cache should
maintain an index for this field or not.
* Just like with databases, field
indexing may require additional overhead
* during updates, but makes select
operations faster.
* <p>
* When indexing SPI and indexed
field is
* of type {@code org.locationtech.jts.geom.Geometry}
(or any subclass of this class) then Ignite will
* consider this index as spatial
providing performance boost for spatial queries.
*
* @return {@code True}
if index must be created for this field in database.
*/ boolean index() default
false;
/**
* Specifies whether index should
be in descending order or not. This property only
* makes sense if {@link #index()}
property is set to {@code true}.
*
* @return {@code True}
if field index should be in descending order.
*/ boolean descending() default
false;
/**
* Specifies whether the specified
field can be {@code null}.
*
* @return {@code True}
if the field is not allowed to accept {@code null} values.
*/ boolean notNull() default
false;
/**
* Specifies field precision for
variable length types - decimal, string and byte array.
*
* @return field precision
for variable length types - decimal, string and byte array.
*/ int precision() default -1;
/**
* Specifies scale for a decimal
field.
*
* @return scale for a
decimal field.
*/ int scale() default -1;
/**
* Array of index groups this field
belongs to. Groups are used for compound indexes,
* whenever index should be created
on more than one field. All fields within the same
* group will belong to the same
index.
* <p>
* Group indexes are needed because
SQL engine can utilize only one index per table occurrence in a query.
* For example if we have two
separate indexes on fields {@code a} and {@code b} of type {@code
X} then
* query {@code select *
from X where a = ? and b = ?} will use for filtering either index on field {@code
a}
* or {@code b} but not
both. For more effective query execution here it is preferable to have a
single
* group index on both fields.
* <p>
* For more complex scenarios
please refer to {@link QuerySqlField.Group} documentation.
*
* @return Array of group
names.
*/ String[] groups() default
{};
/**
* Array of ordered index groups
this field belongs to. For more information please refer to
* {@linkplain QuerySqlField.Group}
documentation.
*
* @return Array of ordered
group indexes.
* @see #groups()
*/ Group[] orderedGroups() default {};
/**
* Property name. If not provided
then field name will be used.
*
* @return Name of property.
*/ String name() default "";
/**
* Index inline size in bytes. When
enabled part of indexed value will be placed directly to index pages,
* thus minimizing data page
accesses, thus incraesing query performance.
* <p>
* Allowed values:
* <ul>
* <li>{@code -1} (default) -
determine inline size automatically (see below)</li>
* <li>{@code 0} - index
inline is disabled (not recommended)</li>
* <li>positive value - fixed index
inline</li>
* </ul>
* When set to {@code -1},
Ignite will try to detect inline size automatically. It will be no more than
* {@link CacheConfiguration#getSqlIndexMaxInlineSize()}.
Index inline will be enabled for all fixed-length types,
* but <b>will not be enabled</b> for {@code String}.
* <p>
* When index group is used, inline
size must be defined in {@link QueryGroupIndex#inlineSize()}. Any
value
* except of {@code -1}
defined on a specific column will lead to exception.
*
* @return Index inline size
in bytes.
*/ int inlineSize() default
QueryIndex.DFLT_INLINE_SIZE;
/**
* Describes group of index and
position of field in this group.
* <p>
* Opposite to {@link #groups()}
this annotation gives control over order of fields in a group index.
* This can be needed in scenarios
when we have a query like
* {@code select * from X
where a = ? and b = ? order by b desc}. If we have index {@code (a
asc, b asc)}
* sorting on {@code b} will
be performed. Here it is preferable to have index {@code (b desc, a
asc)}
* which will still allow query to
search on index using both fields and avoid sorting because index
* is already sorted in needed way.
*
* @see #groups()
* @see #orderedGroups()
*/ @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,
ElementType.FIELD})
@SuppressWarnings("PublicInnerClass") public static @interface Group { /**
* Group index name where this
field participate.
*
* @return Group index
name
*/ String name();
/**
* Fields in this group index
will be sorted on this attribute.
*
* @return Order number.
*/ int order();
/**
* Defines sorting order for
this field in group.
*
* @return True if field
will be in descending order.
*/ boolean descending() default false;
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!