add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE TABLE post (
id serial primary key,
title text,
content text,
author_id INT
);


insert into post (author_id, title, content) values
(1, 'AAAA', 'Although Tolstoy wrote most of the book, including all the narration, in Russian, significant portions of dialogue (including its opening paragraph) are written in French with characters often switching between the two languages.'),
(2, 'BBBBBB', ' This reflected 19th century Russian aristocracy, where French, a foreign tongue, was widely spoken and considered a language of prestige and more refined than Russian.'),
(3, 'CCCCC', 'Widely regarded as a pinnacle in realist fiction, Tolstoy considered Anna Karenina his first true novel, when he came to consider War and Peace to be more than a novel.'),
(4, 'DDDDD', 'Although Tolstoy wrote most of the book, including all the narration, in Russian, significant portions of dialogue (including its opening paragraph) are written in French with characters often switching between the two languages.'),
(1, 'EEEEEE', ' This reflected 19th century Russian aristocracy, where French, a foreign tongue, was widely spoken and considered a language of prestige and more refined than Russian.'),
(2, 'FFFFFFFF', 'Widely regarded as a pinnacle in realist fiction, Tolstoy considered Anna Karenina his first true novel, when he came to consider War and Peace to be more than a novel.'),
(3, 'GGGGGGGG', 'Although Tolstoy wrote most of the book, including all the narration, in Russian, significant portions of dialogue (including its opening paragraph) are written in French with characters often switching between the two languages.'),
(4, 'HHHHHHHH', ' This reflected 19th century Russian aristocracy, where French, a foreign tongue, was widely spoken and considered a language of prestige and more refined than Russian.'),
(5, 'IIIIIII', 'Widely regarded as a pinnacle in realist fiction, Tolstoy considered Anna Karenina his first true novel, when he came to consider War and Peace to be more than a novel.'),
(2, 'JJJJJ', 'It has been suggested[14] that it is a deliberate literary device employed by Tolstoy, to use French to portray artifice and insincerity as the language of the theater and deceit while Russian emerges as a language of sincerity, honesty and seriousness.');

10 rows affected
select title
from post
where id > 3
order by (author_id = 3) desc
limit 1
title
GGGGGGGG