We use a constrained optimization framework to derive fundamental scaling laws for both unstructured sensor networks (which use blind sequential search for querying) and structured sensor networks (which use efficient hash-based querying). We find that the scalability of a sensor network's performance depends upon whether or not the increase in energy and storage resources with more nodes is outweighed by the concomitant application-specific increase in event and query loads. Let m be the number of events sensed by a network over a finite period of deployment, q the number of queries for each event, and N the size of the network. Our key finding is that q1/2 ? m must be O(N1/4 ) for unstructured networks, and q2/3 ? m must be O(N1/2 ) for structured networks, to ensure scalable network performance. These conditions determine (i) whether or not the energy requirement per node grows without bound with the network size for a fixed-duration deployment, (ii) whether or not there exist...