
Hey, i have to do 4 very similar queries (5 restrictions, and only the last one - coordinate- varies) . To give you some idea, ive written them down below. SELECT `ad_genes`.`gene_id` FROM `ad_genes`,`annotation` WHERE `ad_genes`.`exp_id`='2' AND `annotation`.`gene_id` = `ad_genes`.`gene_id` AND `annotation`.`species` = 'ath' AND `ad_genes`.`chr` ='1' AND `ad_genes`.`coordinate` = '9'; SELECT `ad_genes`.`gene_id` FROM `ad_genes`,`annotation` WHERE `ad_genes`.`exp_id`='2' AND `annotation`.`gene_id` = `ad_genes`.`gene_id` AND `annotation`.`species` = 'ath' AND `ad_genes`.`chr` ='1' AND `ad_genes`.`coordinate` = '109'; SELECT `ad_genes`.`gene_id` FROM `ad_genes`,`annotation` WHERE `ad_genes`.`exp_id`='2' AND `annotation`.`gene_id` = `ad_genes`.`gene_id` AND `annotation`.`species` = 'ath' AND `ad_genes`.`chr` ='1' AND `ad_genes`.`coordinate` = '309'; SELECT `ad_genes`.`gene_id` FROM `ad_genes`,`annotation` WHERE `ad_genes`.`exp_id`='2' AND `annotation`.`gene_id` = `ad_genes`.`gene_id` AND `annotation`.`species` = 'ath' AND `ad_genes`.`chr` ='1' AND `ad_genes`.`coordinate` ='409'; The thing is, when i execute them this way, each one takes about 500ms, so that makes 2 seconds in total (which is kinda crap). I could just create 1 query by concatenating the 4 coordinates and use coordinate IN (9,109,309,409). This also executes in about 500ms (which is quite an improvement). However, it is possible that there are no results (for 1 or more of these coordinates), and thus i do not always get the correct amount of data back. To make matters worse, sometimes these coordinates can be te same, and then i also have less then 4 results (i can filter those out with php however). So, is there any way to make these 4 queries (within about 500ms) and in such a way that i get always 4 results (which might be empty, but then i know at least that) ? Michiel PS: the 4 coordinates vary of course, this is just an example. -- ================================================================== Michiel Van Bel PhD student Tel:+32 (0)9 331 36 95 fax:+32 (0)9 3313809 VIB Department of Plant Systems Biology, Ghent University Technologiepark 927, 9052 Gent, BELGIUM mibel@psb.ugent.be http://www.psb.ugent.be ==================================================================