Tuesday 15 March 2011

sql - postgresql querying on multiple identical tables -


Hello I have several databases, like mytable_2009_11_19_03 where the last 2 numbers identify hours : 00), now I want to query something from _00 to 2_2. It can be done this way but it is really clumsy select * mytable_2009_11_19_00 from where type = 15 select union * mytable_2009_11_19_01 from where type = 15 union .......... * * Select * type = 15

from mytable_2009_11_19_23 How can I make it easier? It is related to

The easiest solution will be to create a view of all the tables, then you can query them You can easily write a process to generate visualization easily. In addition, if you use "All Union", then it will be faster, if you want the result to be all the rows (as opposed to the separate rows) and you can select it separately and hold different rows If you ever need it, you sometimes need it.


No comments:

Post a Comment