473,594 Members | 2,682 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

curius behavior of planner after analyze, (Pg7.5)

Hello

I found following select where plan before vacuum analyse is better than
after vacuum. What I have to do? I can change only set statistic for any
column. How I can find which columns I have to alter?

Regards
Pavel Stehule

intra_test=# explain analyze select t.value, t.sp_op_id,
s.obchodni_prip ad_id, o.popis, p.popis, op.jmeno, q.comment, op.partner_id
from techbox t, sp_o
p_produkt s, techreq q, obchodni_pripad o, produkt p, obchodni_partne r op
where lcase(value) like '%zemek%' and t.sp_op_id=s.sp _op_id and
t.techr_id=q.t
echr_id and s.obchodni_prip ad_id=o.obchodn i_pripad_id and
p.produkt_id=s. produkt_id and o.partner_id=op .partner_id;

QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------
Nested Loop (cost=512.53..5 51.66 rows=3 width=1108) (actual
time=72.236..72 .740 rows=2 loops=1)
-> Nested Loop (cost=512.53..5 33.75 rows=3 width=963) (actual
time=72.176..72 .637 rows=2 loops=1)
-> Hash Join (cost=512.53..5 15.87 rows=3 width=814) (actual
time=72.097..72 .519 rows=2 loops=1)
Hash Cond: ("outer".produk t_id = "inner".produkt _id)
-> Seq Scan on produkt p (cost=0.00..2.6 6 rows=132
width=520) (actual time=0.010..0.2 59 rows=132 loops=1)
-> Hash (cost=512.52..5 12.52 rows=4 width=302) (actual
time=71.998..71 .998 rows=0 loops=1)
-> Nested Loop (cost=1.14..512 .52 rows=4 width=302)
(actual time=0.807..71. 989 rows=2 loops=1)
-> Hash Join (cost=1.14..488 .50 rows=4
width=294) (actual time=0.724..71. 853 rows=2 loops=1)
Hash Cond: ("outer".techr_ id =
"inner".techr_i d)
-> Seq Scan on techbox t
(cost=0.00..487 .16 rows=35 width=153) (actual time=0.535..71. 649 rows=2
loops=1)
Filter: (lower((value): :text) ~~
'%zemek%'::text )
-> Hash (cost=1.09..1.0 9 rows=19
width=149) (actual time=0.162..0.1 62 rows=0 loops=1)
-> Seq Scan on techreq q
(cost=0.00..1.0 9 rows=19 width=149) (actual time=0.039..0.1 18 rows=19
loops=1)
-> Index Scan using cccc on sp_op_produkt s
(cost=0.00..6.0 0 rows=1 width=12) (actual time=0.043..0.0 49 rows=1
loops=2)
Index Cond: ("outer".sp_op_ id =
s.sp_op_id)
-> Index Scan using obchodni_pripad _pkey on obchodni_pripad o
(cost=0.00..5.9 5 rows=1 width=153) (actual time=0.029..0.0 33 rows=1
loops=2)
Index Cond: ("outer".obchod ni_pripad_id =
o.obchodni_prip ad_id)
-> Index Scan using obchodni_partne r_pkey on obchodni_partne r op
(cost=0.00..5.9 6 rows=1 width=149) (actual time=0.022..0.0 26 rows=1
loops=2)
Index Cond: ("outer".partne r_id = op.partner_id)
Total runtime: 73.358 ms
(20 øádek)

intra_test=# VACUUM ANALYZE;
VACUUM
intra_test=# explain analyze select t.value, t.sp_op_id,
s.obchodni_prip ad_id, o.popis, p.popis, op.jmeno, q.comment, op.partner_id
from techbox t, sp_o
p_produkt s, techreq q, obchodni_pripad o, produkt p, obchodni_partne r op
where lcase(value) like '%zemek%' and t.sp_op_id=s.sp _op_id and
t.techr_id=q.t
echr_id and s.obchodni_prip ad_id=o.obchodn i_pripad_id and
p.produkt_id=s. produkt_id and o.partner_id=op .partner_id;

QUERY PLAN

--------------------------------------------------------------------------------------------------------------------------------------------------------
---------------
Hash Join (cost=683.73..7 50.25 rows=35 width=114) (actual
time=89.755..95 .817 rows=2 loops=1)
Hash Cond: ("outer".techr_ id = "inner".techr_i d)
-> Hash Join (cost=682.59..7 48.75 rows=35 width=100) (actual
time=88.764..94 .811 rows=2 loops=1)
Hash Cond: ("outer".partne r_id = "inner".partner _id)
-> Seq Scan on obchodni_partne r op (cost=0.00..53. 99 rows=2399
width=28) (actual time=0.066..6.0 29 rows=2399 loops=1)
-> Hash (cost=682.50..6 82.50 rows=35 width=76) (actual
time=85.297..85 .297 rows=0 loops=1)
-> Hash Join (cost=621.19..6 82.50 rows=35 width=76)
(actual time=77.796..85 .258 rows=2 loops=1)
Hash Cond: ("outer".obchod ni_pripad_id =
"inner".obchodn i_pripad_id)
-> Seq Scan on obchodni_pripad o (cost=0.00..48. 57
rows=2514 width=30) (actual time=0.008..4.9 48 rows=2514 loops=1)
-> Hash (cost=621.10..6 21.10 rows=35 width=50)
(actual time=76.866..76 .866 rows=0 loops=1)
-> Hash Join (cost=616.61..6 21.10 rows=35
width=50) (actual time=76.429..76 .853 rows=2 loops=1)
Hash Cond: ("outer".produk t_id =
"inner".produkt _id)
-> Seq Scan on produkt p
(cost=0.00..2.6 6 rows=132 width=29) (actual time=0.012..0.2 60 rows=132
loops=1)
-> Hash (cost=616.53..6 16.53 rows=35
width=29) (actual time=76.287..76 .287 rows=0 loops=1)
-> Nested Loop (cost=0.00..616 .53
rows=35 width=29) (actual time=1.055..76. 274 rows=2 loops=1)
-> Seq Scan on techbox t
(cost=0.00..487 .16 rows=35 width=21) (actual time=0.621..75. 650 rows=2
loops=1)
Filter:
(lower((value): :text) ~~ '%zemek%'::text )
-> Index Scan using cccc on
sp_op_produkt s (cost=0.00..3.6 9 rows=1 width=12) (actual
time=0.277..0.2 84 r
ows=1 loops=2)
Index Cond:
("outer".sp_op_ id = s.sp_op_id)
-> Hash (cost=1.09..1.0 9 rows=19 width=22) (actual time=0.195..0.1 95
rows=0 loops=1)
-> Seq Scan on techreq q (cost=0.00..1.0 9 rows=19 width=22)
(actual time=0.081..0.1 48 rows=19 loops=1)
Total runtime: 96.596 ms
(22 øádek)

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #1
0 951

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1507
by: Michele | last post by:
Hi all, There's a web-based project I'm working on, which my boss insists should be implemented as a java web service: I know Java, but I'm a complete newcomer to web services, so I would badly need your enlightened opinion to figure out if my boss is right. I'm going to have two sorts of clients connecting to my (Apache) web server: a "planner" user, making schedules of activities to be performed and recording them on a MySQL database,...
6
2598
by: Rob Fielding | last post by:
Hi, We're currently experiencing a problem where SQL statements are failing when entring a '' for not not-null integer columns: ERROR: pg_atoi: zero-length string This was discovered just after a database migration from 7.2 to 7.3.4. Example:
1
2472
by: Alex Satrapa | last post by:
I have a table from which I'm trying to extract certain information. For historical reasons, we archive every action on a particular thing ('thing' is identified, funnily enough, by 'id'). So the only way to find out the current state of a particular combination of attributes is to "select distinct on (id, ...) ... order by date desc". In the examples below, I've taken real output from psql and done a global search/replace on various...
2
1275
by: Chris Travers | last post by:
Hi all; I suspect I know what the answer here is, but I thought I would ask anyway. How transparent are SQL language functions from the planner's perspective? For example if I create a table: CREATE TABLE proof_of_concept( poc_id serial primary key, testing text );
59
7147
by: Jeff Bowden | last post by:
For ease of configuration and other reasons, I would like for my single-user GUI app to be able to use postgresql in-process as a library accessing a database created in the users home directory. I think I could possibly get what I want by launching a captive copy of postmaster with appropriate args but it seems conceptually cleaner to not have a seperate process at all. Has anyone tried to do anything like this? I've looked at sqlite...
0
945
by: Pavel Stehule | last post by:
Hello I found following select where plan before vacuum analyse is better than after vacuum. What I have to do? I can change only set statistic for any column. How I can find which columns I have to alter? Regards Pavel Stehule intra_test=# explain analyze select t.value, t.sp_op_id,
2
1603
by: Ed L. | last post by:
The planner is choosing a sequential scan for my query. I am trying to understand why since it is clearly not the fastest choice, and what the proper tuning dial is to adjust here. Here's the query: select count(1) from measurement where measure_id = 98; TIA. Here are the details: % psql -c "\d measurement" Table "public.measurement"
5
1225
by: Timothy Perrigo | last post by:
This bug? feature? caused a bit of havoc for us yesterday...A reproducible example follows. Essentially, if you have a table with a primary key called "id", and you create a temp table (via a "select into") containing a subset of the data from the table but where the primary key field is renamed (in the example below, it is called "not_id"), the where clause of the following update statement (which I would expect to generate an error...
1
1731
by: Greg Stark | last post by:
I think this is just a bad case of "nested loops are costed wrong". But it's a really really bad case. Like, even without any overlap in records looked up in the nested loop I cannot imagine it ever being the wrong plan for these stats. And Postgres is insistent on avoiding it, I have to disable both merge and hash joins to get the 5ms nested loop join. db=> EXPLAIN ANALYZE SELECT distinct foo
0
7874
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8246
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8368
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6652
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5738
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3854
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1205
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.