Query optimization to select rows instead of too many or conditions
| От | Arup Rakshit |
|---|---|
| Тема | Query optimization to select rows instead of too many or conditions |
| Дата | |
| Msg-id | 11491969.5OFzSH82DR@linux-wzza.site обсуждение исходный текст |
| Ответы |
Re: Query optimization to select rows instead of too many or conditions
|
| Список | pgsql-general |
Hi, Suppose I want to select the rows from a table, say Emp, as below : Select * from Emp where (attr1 = val11 and attr2 = val12 and attr3 = val13) or (attr1 = val14and attr2 = val15 and attr3 = val16); Now suppose I got (x1, x2, x3) and (y1, y2, y3). Then I need to rewrite my query as : Select * from Emp where (attr1 = val11 and attr2 = val12 and attr3 = val13) or (attr1 = val14 and attr2 = val15 and attr3 = val16) or (attr1 = x1 and attr2 = x2 and attr3 = x3) or (attr1 = y1 and attr2 = y2 and attr3 = y3); So for each new set I need to add one more `or` conditions. It seems wired. Any better way to get it done ? -- ================ Regards, Arup Rakshit ================ Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible,you are, by definition, not smart enough to debug it. --Brian Kernighan
В списке pgsql-general по дате отправления: