Re: [SQL] Good Optimization
От | Patrik Kudo |
---|---|
Тема | Re: [SQL] Good Optimization |
Дата | |
Msg-id | 37846E02.CB83939C@partitur.se обсуждение исходный текст |
Ответ на | Re: [SQL] Good Optimization (wieck@debis.com (Jan Wieck)) |
Ответы |
Re: [SQL] Good Optimization
Re: [SQL] Good Optimization |
Список | pgsql-sql |
Jan Wieck wrote: > > > > > Bruce Momjian wrote: > > >=20 > > > Added to TODO: > > >=20 > > > * In WHERE x=3D3 AND x=3Dy, add y=3D3 > > > > I don't know if I'm way off, but wouldn't removing "x=3Dy" improve > > performance further? > > Maybe in the simple case above. But it will probably change > the result set if someone issues > > SELECT a.x, b.y FROM a, b WHERE a.x >= 10 > AND a.x <= 19 > AND a.x = b.x; > > which should then get rewritten into > > SELECT a.x, b.y FROM a, b WHERE a.x >= 10 > AND a.x <= 19 > AND a.x = b.x > AND b.x >= 10 > AND b.x <= 19; > > This time the "a.x = b.x" is important! Ouch... didn't think that far. However, if an cache is implemented it might be worth the extra overhead to optimize special cases like the one I commented on. Since most systems use a fairly limited set of queries (I suppose...) most of the queries will be cached quite fast. BTW, I just love the work all of you are doing! Postgres is awsome! /Kudo
В списке pgsql-sql по дате отправления: