sql_examples.sql
This commit is contained in:
parent
3c9b9267a5
commit
4a3d453d0d
34
sql_examples.sql
Normal file
34
sql_examples.sql
Normal file
@ -0,0 +1,34 @@
|
||||
EXPLAIN ANALYSE
|
||||
SELECT *
|
||||
FROM post
|
||||
ORDER BY create_on
|
||||
FETCH FIRST 50 ROWS ONLY;
|
||||
|
||||
EXPLAIN ANALYSE
|
||||
SELECT *
|
||||
FROM post
|
||||
ORDER BY create_on
|
||||
OFFSET 50 ROWS FETCH NEXT 50 ROWS ONLY;
|
||||
|
||||
EXPLAIN ANALYSE
|
||||
SELECT *
|
||||
FROM post
|
||||
ORDER BY create_on
|
||||
OFFSET 9950 ROWS FETCH NEXT 50 ROWS ONLY;
|
||||
|
||||
CREATE INDEX idx_post_created_on ON post (create_on DESC);
|
||||
|
||||
CREATE INDEX idx_post_created_on ON post (create_on DESC, id DESC);
|
||||
|
||||
EXPLAIN ANALYSE
|
||||
SELECT *
|
||||
FROM post
|
||||
ORDER BY create_on DESC, id DESC
|
||||
FETCH FIRST 50 ROWS ONLY;
|
||||
|
||||
EXPLAIN ANALYSE
|
||||
SELECT *
|
||||
FROM post
|
||||
WHERE (create_on, id) < ('2022-10-30 00:11:43.224314', '8766d496-44c7-4e48-af29-b19178692cd9')
|
||||
ORDER BY create_on DESC
|
||||
FETCH FIRST 50 ROWS ONLY
|
Loading…
Reference in New Issue
Block a user