Results 1 to 2 of 2

Thread: Merge join

  1. #1
    Join Date
    Nov 2002
    Posts
    16

    Question Unanswered: Merge join

    how can i to reduce the time in merge join.

    my sql statment:
    SELECT c.adpage_id AS adpage_id, c.name AS adpage_name
    FROM tbl_showlog AS a,
    tbl_screen AS b,
    tbl_adpage AS c
    WHERE a.screen_id = b.screen_id
    AND a.adpage_id = c.adpage_id
    AND b.company_id = 2
    GROUP BY c.adpage_id, c.name

    query plan:
    Group (cost=34366.02..34655.83 rows=881 width=84)
    -> Merge Join (cost=34366.02..34611.78 rows=8810 width=84)
    -> Index Scan using tbl_adpage_adpage_id_name_idx on tbl_adpage c (cost=0.00..111.66 rows=787 width=72)
    -> Sort (cost=34366.02..34366.02 rows=8810 width=12)
    -> Nested Loop (cost=0.00..33788.77 rows=8810 width=12)
    -> Index Scan using tbl_screen_screen_company_id_id on tbl_screen b (cost=0.00..5.21 rows=1 width=4)
    -> Index Scan using tbl_showlog_screen_id_idx on tbl_showlog a (cost=0.00..33673.44 rows=8810 width=8)

  2. #2
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    hints

    1. always use single quotes
    '2'
    the parser will then make it better

    the only thing you can do is change some settings of postgres

    this query cannot be tuned more. maybe you change the table structure a little bit?!??
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •