You need to give some more detail about the project:
How many sensors are there?
How often do they need to be polled?
How many relays are there?
What sort of response is necessary for the turning off or on of the relay and how often? (i.e. is a 1, 10, 100 ms delay OK?)
How often will a sensor be enabled/disabled by the user or program?
As an aside, it sounds like a Gertboard would be ideal for this application if you have not got one already. (https://www.sparkfun.com/products/11773
or Farnell et. al.)
Without answers to the above questions I will shoot in the dark....
To avoid latency with the SQL lookups, use a "push" scenario rather than the Arduino polling frequently, reading the same data over and over. e.g.
When the units (Arduino and RPi(this is where the Gertboard would help with syncronisation)) are initially turned on, the rpi reads the DB and downloads which sensors should be enabled to the Arduino, to be written to a lookup table. e.g.
Sensor 1 is off; sensor 2 is on; sensor 3 is on; sesnor 4 is off
After that the RPi will only send changes as they are made to the status of each sensor, by UART to the Arduino (e.g. "3:0"<CR> ,not every sensor). The Arduino would poll the its UART every so many ms using a non-blocking poll (see blink without delay example sketch). The frequency would depend on the answers above but should not be critical as the Arduino UART has a 64 byte buffer so should buffer quite a few updates.
The Arduino would read the sensors according to its internal lookup table (as to which ones should be read) at a frequency determined by answers above. these would be sent by serial to the Pi in a similar fashion. e.g.
Th Pi would be polling its serial port and write these to the DB.
To minimise communication between the Pi and Arduino the relays could be activated through the Pi GPIO (buffered of course) as I assume a couple of ms latency of the Pi will not be critical. Be quicker and less overhead than telling the Arduino to turn them on.