# query-planner

Published articles for query-planner.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Why your index is not being used, and why the planner is usually right

DevFeed: [Why your index is not being used, and why the planner is usually right](<https://devfeed.tech/articles/why-your-index-is-not-being-used-and-why-the-planner-is-usually-right-39590.md>)

Original publisher: [Read original article](<https://ankit-rana.com/logs/38-why-your-index-is-not-being-used/>)

Author: hello@ankit-rana.com

Published: 2026-08-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [Ankit Rana | Mechanical Sympathy](<https://devfeed.tech/sources/ankit-rana-mechanical-sympathy.md>)

Topics: [Query (disambiguation)](<https://devfeed.tech/topics/query.md>), [MySQL](<https://devfeed.tech/topics/mysql.md>), [bug](<https://devfeed.tech/topics/bug.md>)

Tags: [bug](<https://devfeed.tech/tags/bug.md>), [cardinality](<https://devfeed.tech/tags/cardinality.md>), [database-performance](<https://devfeed.tech/tags/database-performance.md>), [explain](<https://devfeed.tech/tags/explain.md>), [function](<https://devfeed.tech/tags/function.md>), [indexes](<https://devfeed.tech/tags/indexes.md>), [indexing](<https://devfeed.tech/tags/indexing.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [predicate](<https://devfeed.tech/tags/predicate.md>), [query](<https://devfeed.tech/tags/query.md>), [query-planner](<https://devfeed.tech/tags/query-planner.md>)

### AI overview

This tutorial explains why database indexes may not be used even when they exist. It focuses on inaccurate cardinality estimates caused by stale statistics, predicates that prevent index matching, implicit casts, and cases where sequential scans are the cheaper choice.

### Source excerpt

An unused index is almost never a planner bug. It is usually a predicate the planner cannot match to the index, such as a function or an implicit cast applied to the column, or a cardinality estimate that is wrong because statistics are stale. When the estimate is right and the planner still refuses, it is often correct: past a few percent of the table, random access through an index costs more than reading the table sequentially. The diagnostic that matters is the gap between estimated and actual rows in EXPLAIN ANALYZE.

## Cursor Pagination vs Offset Pagination: Which One Should You Use?

DevFeed: [Cursor Pagination vs Offset Pagination: Which One Should You Use?](<https://devfeed.tech/articles/cursor-pagination-vs-offset-pagination-which-one-should-you-use-39652.md>)

Original publisher: [Read original article](<https://www.gauravsarma.com/posts/2026-03-11_cursor-pagination-vs-offset-pagination>)

Published: 2026-03-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Gaurav Sarma's Blog](<https://devfeed.tech/sources/gaurav-sarma-s-blog.md>)

Topics: [API](<https://devfeed.tech/topics/api.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [apis](<https://devfeed.tech/tags/apis.md>), [b-tree](<https://devfeed.tech/tags/b-tree.md>), [database](<https://devfeed.tech/tags/database.md>), [index](<https://devfeed.tech/tags/index.md>), [indexes](<https://devfeed.tech/tags/indexes.md>), [query-planner](<https://devfeed.tech/tags/query-planner.md>), [rest-apis](<https://devfeed.tech/tags/rest-apis.md>)

### AI overview

This tutorial compares offset, cursor, and keyset pagination for REST APIs. It explains that offset pagination becomes slower at deep pages because the database scans and discards preceding rows, while concurrent inserts can cause duplicates or skipped results. Cursor pagination uses an indexed position for more consistent performance but does not support random page access; keyset pagination generalizes the approach to arbitrary sort orders.

### Source excerpt

. [Cursor vs Offset Pagination](cursor-pagination-vs-offset-pagination-cover...

## SQLite Query Optimisation - How the Planner Thinks and Where It Goes Wrong

DevFeed: [SQLite Query Optimisation - How the Planner Thinks and Where It Goes Wrong](<https://devfeed.tech/articles/sqlite-query-optimisation-how-the-planner-thinks-and-where-it-goes-wrong-39650.md>)

Original publisher: [Read original article](<https://www.gauravsarma.com/posts/2026-03-08_sqlite-query-optimisation>)

Published: 2026-03-08T00:00:00Z

Content type: tutorial

Language: en

Sources: [Gaurav Sarma's Blog](<https://devfeed.tech/sources/gaurav-sarma-s-blog.md>)

Topics: [SQLite](<https://devfeed.tech/topics/sqlite.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Databases](<https://devfeed.tech/topics/databases.md>)

Tags: [b-tree](<https://devfeed.tech/tags/b-tree.md>), [index](<https://devfeed.tech/tags/index.md>), [optimisation](<https://devfeed.tech/tags/optimisation.md>), [planner](<https://devfeed.tech/tags/planner.md>), [query](<https://devfeed.tech/tags/query.md>), [query-planner](<https://devfeed.tech/tags/query-planner.md>), [sql](<https://devfeed.tech/tags/sql.md>), [sqlite](<https://devfeed.tech/tags/sqlite.md>)

### AI overview

A tutorial on how SQLite's query planner chooses between index searches and full table scans. It explains planner behavior, the effects of query patterns and data distribution, and how to avoid conditions that make indexes inaccessible or scans appear cheaper.

### Source excerpt

. [SQLite Query Optimisation](sqlite-query-optimisation-cover...