Re: where (x,y,z) in ((x1,y1, z1), (x1,y1, z1), (x1,y1, z1), (x2,y2, z2)) (not) optimized
| От | Grzegorz Jaśkiewicz |
|---|---|
| Тема | Re: where (x,y,z) in ((x1,y1, z1), (x1,y1, z1), (x1,y1, z1), (x2,y2, z2)) (not) optimized |
| Дата | |
| Msg-id | 2f4958ff0901260612w6879cdbelb4b9f0ab464de6ee@mail.gmail.com обсуждение |
| Ответ на | Re: where (x,y,z) in ((x1,y1, z1), (x1,y1, z1), (x1,y1, z1), (x2,y2, z2)) (not) optimized (Filip Rembiałkowski <plk.zuber@gmail.com>) |
| Список | pgsql-general |
On Mon, Jan 26, 2009 at 1:58 PM, Filip Rembiałkowski <plk.zuber@gmail.com> wrote: > 2009/1/26 Grzegorz Jaśkiewicz <gryzman@gmail.com> >> >> Hey folks, >> >> I have question really for all mighty developers, but don't want to >> spam -hackers with it. >> >> why : >> select * from foo where X in (1,1,1,1,1,1,1,1) --- same values in search. >> or select * from foo where (x,y) in >> ((1,2),(1,2),(1,2),(1,2),(1,2),(1,2),(1,2)); >> >> never gets optimized by planner, etc ? > > I would guess that optimizing silly-written queries was always a > low-priority task... > EXPLAIN ANALYZE SELECT * FROM atest where id in > (1,2,3,3,3,3,3,3,3,5,5,5,5,5,5,5,5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); > EXPLAIN ANALYZE SELECT * FROM atest where id in (1,2,3,5); > > shows that second query is 2.5 times faster than the first ( 0.170 ms / > 0.070 ms). the difference isn't so small than :) silly or not, sometimes you end up with such collection passed on in some silly languages. -- GJ
В списке pgsql-general по дате отправления: