Title: [Plugin: SharDB] Regarding Database Queries
Last modified: August 20, 2016

---

# [Plugin: SharDB] Regarding Database Queries

 *  [dheeraj.singh](https://wordpress.org/support/users/dheerajsingh-1/)
 * (@dheerajsingh-1)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-shardb-regarding-database-queries/)
 * Hi,
 * I am using an installation of Wp Multi site at infonary.com and palling to host
   about 100K blogs.
 * I have purchased and been through the shardb installation guide and wanted to
   know that will the structure of database queries remain the same. For example
   I am using the following query
 *     ```
       <?php function get_all_sites($letter) {
       	global $wpdb;
   
       	// Query all blogs from multi-site install and domain LIKE '$letter%'
       	$blogs = $wpdb->get_results("SELECT blog_id,domain,path FROM wp_blogs where blog_id > 1 ORDER BY domain");
   
       	// Start unordered list
       	echo '<div id="right1" style="width: 960px;"><ul class="contentright">';
   
       	// For each blog search for blog name in respective options table
       	foreach( $blogs as $blog ) {
   
       		// Query for name from options table
       		$blogname = $wpdb->get_results("SELECT option_value FROM wp_".$blog->blog_id ."_options WHERE option_name='blogdescription' ");
       		foreach( $blogname as $name ) { 
   
       			// Create bullet with name linked to blog home pag
       			echo '<li style="float: left; width: 210px; margin-right: 10px">';
       			echo '<a href="http://';
       			echo $blog->domain;
       			echo $blog -> path;
       			echo '">';
       			echo $name->option_value;
       			echo '</a></li>';
   
       		}
       	}
   
       	// End unordered list
       	echo '</ul></div>';
       }
       get_all_sites(b);
       ?>
       ```
   
 * to call a list of blogs by letter. My question is that would I need to change
   this query after indstalling shardb.
 * [http://wordpress.org/extend/plugins/shardb/](http://wordpress.org/extend/plugins/shardb/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * (@andrea_r)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-shardb-regarding-database-queries/#post-2431331)
 * You’re calling the $wpdb class correctly, so no – you will **not** have to change
   your queries after sharding the database.
 *  Thread Starter [dheeraj.singh](https://wordpress.org/support/users/dheerajsingh-1/)
 * (@dheerajsingh-1)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-shardb-regarding-database-queries/#post-2431354)
 * Thanks ..

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: SharDB] Regarding Database Queries’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/shardb.svg)
 * [SharDB](https://wordpress.org/plugins/shardb/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shardb/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shardb/)
 * [Active Topics](https://wordpress.org/support/plugin/shardb/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shardb/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shardb/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [dheeraj.singh](https://wordpress.org/support/users/dheerajsingh-1/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-shardb-regarding-database-queries/#post-2431354)
 * Status: not resolved