dbTalk Databases Forums  

[BUGS] BUG #2027: Select on view hangs.

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2027: Select on view hangs. in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dmitri Fuerle
 
Posts: n/a

Default [BUGS] BUG #2027: Select on view hangs. - 11-08-2005 , 06:59 AM







The following bug has been logged online:

Bug reference: 2027
Logged by: Dmitri Fuerle
Email address: dmitri.fuerle (AT) gmail (DOT) com
PostgreSQL version: 8.1
Operating system: Mac OS X
Description: Select on view hangs.
Details:

A select on the following view hangs the database
and produces the lock table at the bottom of the message


CREATE OR REPLACE VIEW "public"."report_dci_efficiency" (
invoice_id,
bill_to_name,
ship_to_name,
po_num,
ordered_date,
promised_date,
ship_date,
number_days,
late_report_note,
ignore_late)
AS
SELECT i.invoice_id, billa.comp_name AS bill_to_name, shipa.comp_name AS
ship_to_name, i.po_num, i.accepted AS ordered_date, holi.due_date AS
promised_date, (i.invoiced_date)::date AS ship_date,
((i.invoiced_date)::date - holi.due_date) AS number_days,
i.late_report_note, i.ignore_late
FROM (((invoice i JOIN history_order_line_item holi ON ((i.order_id =
holi.order_id))) JOIN address billa ON ((i.bill_to_address_id =
billa.address_id))) JOIN address shipa ON ((i.ship_to_address_id =
shipa.address_id)))
WHERE ((holi.history_order_line_item_id = (
SELECT max(tmpholi.history_order_line_item_id) AS max
FROM history_order_line_item tmpholi
WHERE (tmpholi.order_id = i.order_id)
)) AND (i.bill_to_address_id <> 12373))
ORDER BY i.invoiced_date DESC;


locktype | database | relation | page | tuple | transactionid |
classid | objid | objsubid | transaction | pid | mode | granted

---------------+----------+----------+------+-------+---------------+-------
--+-------+----------+-------------+------+-----------------+---------
relation | 7140087 | 10342 | | | |
Quote:
| | 54154 | 8978 | AccessShareLock | t
relation | 7140087 | 7582825 | | | |
| | 54152 | 8972 | AccessShareLock | t
transactionid | | | | | 54136 |
| | 54136 | 8967 | ExclusiveLock | t
transactionid | | | | | 54154 |
| | 54154 | 8978 | ExclusiveLock | t
relation | 7140087 | 7140308 | | | |
| | 54152 | 8972 | AccessShareLock | t
relation | 7140087 | 7582785 | | | |
| | 54152 | 8972 | AccessShareLock | t
relation | 7140087 | 7140407 | | | |
| | 54152 | 8972 | AccessShareLock | t
relation | 7140087 | 7140528 | | | |
| | 54152 | 8972 | AccessShareLock | t
relation | 7140087 | 7140393 | | | |
| | 54152 | 8972 | AccessShareLock | t
transactionid | | | | | 54152 |
| | 54152 | 8972 | ExclusiveLock | t
(10 rows)

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
  #2  
Old   
Alvaro Herrera
 
Posts: n/a

Default Re: [BUGS] BUG #2027: Select on view hangs. - 11-08-2005 , 07:18 AM






Dmitri Fuerle wrote:

Quote:
A select on the following view hangs the database
and produces the lock table at the bottom of the message
It doesn't look like it's actually waiting on a lock (unless you managed
to paste only a portion of pg_locks). Are you running on NFS or some
such?


--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2027: Select on view hangs. - 11-08-2005 , 08:50 AM



"Dmitri Fuerle" <dmitri.fuerle (AT) gmail (DOT) com> writes:
Quote:
A select on the following view hangs the database
Are you sure it's actually hung, and not (say) computing like mad?
Perhaps the planner chose a bad plan that will take a long time.
Have you ANALYZEd all the tables underlying the view?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.