Re: query optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jack,

I'm expecting less than 10 records in the resulting set.
The BlockUnit table contains 337,253 records; the InteractionParts table contains 279,953 records.

It takes currently 8.3 seconds to execute the query as I have it.

Erh, this is embarassing but I'm going to need some help re-writing it with EXISTS...

Thanks for the help so far,

Yves

  ----- Original Message ----- 
  From: Jack van Zanen 
  To: Chris 
  Cc: YVES SUCAET ; php-db@xxxxxxxxxxxxx 
  Sent: Thursday, September 25, 2008 7:49 PM
  Subject: Re:  query optimization


  If you can answer the other questions that would help as well

  you can try rewriting using "exist" instead of "in"

  But without the basic information  like number of records expected and explain plan it is very hard to come up with a better solution.


  Brgds

  Jack


  2008/9/26 Chris <dmagick@xxxxxxxxx>

    Jack van Zanen wrote:

      Hi

      If I am not mistaken,
      the second part of the union contains all rows that are in the first part of
      the union. just remove the first part.



    Kind of.

    The first part is a join, the second isn't.

    I was going to suggest rewriting the subquery into a single:

    where
    ip.blockid in (...)
    or
    bu.blockid in (...)

    however that'll probably be slower, but def. worth a try. 


    -- 
    Postgresql & php tutorials
    http://www.designmagick.com/





  -- 
  J.A. van Zanen

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux