Skip to main content

All Questions

1 vote
0 answers
33 views

postgresql EXPLAIN gives seq scan rows = 12 for filter id < 10

I ran explain command on this query: EXPLAIN Select * from project_project where id < 10 FOR UPDATE And the plan output: "LockRows (cost=0.00..6.57 rows=12 width=18305)" " -> ...
Azima's user avatar
  • 4,033
0 votes
1 answer
137 views

How to get explain for a foreign table

I have a query that is essentially SELECT * FROM foreign_table_a LEFT JOIN local_table_b on foreign_table_a.id = local_table_b.id I'm looking at the explain analyse in datagrip and I don't really get ...
TreeWater's user avatar
  • 847
-1 votes
1 answer
33 views

How can I optimize DB query?

My db query is taking 5 seconds instead of <1 second earlier and the culprit query is : explain extended select A,B,C from table flow where (status in ('X' , 'Y' , 'Z')) and priority=1 and ...
user124's user avatar
  • 433
3 votes
2 answers
446 views

Why INSERT query is 3-4 times slower than SELECT?

Application talks to YugabyteDB instance with YCQL driver(Gocql). We have below two queries (for example): SELECT col2, col3, col4, col5 FROM table1 WHERE primarykeycol = ...
overexchange's user avatar
2 votes
1 answer
790 views

PostgreSQL EXPLAIN: How do I see a plan AS IF certain tables had millions of rows?

This is a question about PostgreSQL's EXPLAIN command. This command shows you how the optimizer will execute your SQL based on the data in your tables. We are not in prod yet, so all of our tables ...
Daniel Kaplan's user avatar
1 vote
2 answers
314 views

How to get number of rows accessed in each table of a query sql Oracle DB

I have to get number of rows accessed in each table in sql query - oracle db. For example: select * from a inner join b on a.t = b.t where a.x in (1,2,3) result expect: table a: 5 rows table b: 10 ...
qxk71551's user avatar
2 votes
2 answers
90 views

Why and how SQL condition not in psql explain plan?

I try to analyze plans for join query benchmark https://github.com/gregrahn/join-order-benchmark For example, I execute the following command: EXPLAIN SELECT * FROM aka_name AS an, cast_info AS ...
Mihail Salnikov's user avatar
0 votes
1 answer
627 views

Postgresql: Seq Scan instead of Index Scan

I have following table: create table if not exists inventory ( expired_at timestamp(0), -- ... ); create index if not exists inventory_expired_at_index on inventory (expired_at); However ...
Rudziankoŭ's user avatar
  • 11.1k
0 votes
4 answers
299 views

How is `rows` param in `explain analyze` (postgresql) estimated in case of a function scan?

I was checking execution plans for parts of a complicated query and came up with this: postgres=# explain analyze ...
Mike Koltsov's user avatar
3 votes
1 answer
2k views

PostgreSQL: Is it possible to print the query plan of a running query?

I ran the same report query regularly and most of the time the query completes within minutes. However, it sometimes gets stuck for hours in a nondeterministic way. When it got stuck, I repeated the ...
Marcin Barczyński's user avatar
7 votes
1 answer
3k views

Why is Postgres EXPLAIN ANALYZE execution_time different than when I run the actual query?

I'm using a database client to test. Using EXPLAIN ANALYZE: Hash Join (cost=5.02..287015.54 rows=3400485 width=33) (actual time=0.023..1725.842 rows=3327845 loops=1) Hash Cond: ((fact_orders....
john's user avatar
  • 34.8k
0 votes
1 answer
167 views

Why does PostgreSQL sorts on a boolean WHERE condition?

I am testing some queries over a bunch of materialized views. All of them have the same structure, like this one: EXPLAIN ANALYZE SELECT mr.foo, ..., CAST(SUM(mr.bar) AS INTEGER) AS stuff FROM ...
Settembre Nero's user avatar
14 votes
1 answer
7k views

What does loop in explain analyze statement mean?

I am profiling my query. postgres=# explain analyze select * from student; QUERY PLAN --------------------------------------------------------------------...
Mangu Singh Rajpurohit's user avatar
0 votes
1 answer
2k views

Using IN with a subquery doesn't use index

I have the fowlloing query select * from mapping_channel_fqdn_virtual_host where id in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); explaining the above query gives me the following result: explain select * ...
Apostolos's user avatar
  • 8,001
2 votes
0 answers
2k views

Explaining the Explain in teradata

Explain sel * from sandbox.comapny_employees ce left join sandbox.comapny_age ca on ce.age=ca.age and ce.age>42 some times its really confusing to understand how explain plan was ...
dev's user avatar
  • 841

15 30 50 per page