Skip to content

Commit

Permalink
feat(jdbc): force using the index on mysql poll queries (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu authored Feb 24, 2023
1 parent 0d02517 commit 092230e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ protected Result<Record> receiveFetch(DSLContext ctx, String consumerGroup) {
AbstractJdbcRepository.field("value"),
AbstractJdbcRepository.field("offset")
)
.from(this.table)
// force using the dedicated index, or it made a scan of the PK index
.from(this.table.useIndex("ix_type__consumers"))
.where(AbstractJdbcRepository.field("type").eq(this.cls.getName()))
.and(DSL.or(List.of(
AbstractJdbcRepository.field("consumers").isNull(),
Expand Down

0 comments on commit 092230e

Please sign in to comment.