-1

I have been told that my web server only allows 75,000 database queries request per hour. I'm wondering if combining query request would lessen the amount of queries or if it doesn't matter. It kind of feel like common sense, but I just want to make sure. Thanks.

$text1 = "text1";
$text2 = "text2";
$text3 = "text3";

SELECT text FROM table WHERE text = '$text1';
SELECT text FROM table WHERE text = '$text2';
SELECT text FROM table WHERE text = '$text3';

3 queries ^---

SELECT text FROM table WHERE 
text = '$text1' OR
text = '$text2' OR
text = '$text3';

1 query ^---

Is the above correct or wrong? Thanks.

jessica
  • 1,667
  • 1
  • 17
  • 35
  • Yes, it will matter. And yes, the query looks correct. With that said, it's rather uncommon to limit the number of queries per hour. I would strongly recommend looking for another host. – rjdown Sep 05 '15 at 19:33
  • @rjdown I think it is expected of a cheap hosting site. Ipage is better than most cheap hosting sites in my opionion. I only spend 136 dollars in a 3 year deal, so I think it's good for now. – jessica Sep 05 '15 at 19:35
  • It's probably less uncommon than you think. Your query's right, but if you're really concerned about hitting that 75K you can alternatively try to slit up your queries between different users. The cap is put on the MySQL user, not the hosting account. – I wrestled a bear once. Sep 05 '15 at 19:36
  • @Adelphia Why is there a loophole if they're going to limit the query requests? Please explain. – jessica Sep 05 '15 at 19:39
  • try them both out and run a benchmark – Funk Forty Niner Sep 05 '15 at 19:39
  • @Adelphia Is it because only one users is allowed per website? – jessica Sep 05 '15 at 19:42
  • @jessica - if there is a loophole it's because you've paid for it. I don't know what services you have. – I wrestled a bear once. Sep 05 '15 at 19:47
  • personally, I feel this question should have been posted in db exchange http://dba.stackexchange.com/ - the answer you accepted below, is of very low quality and is more fit as a comment, if you ask me. I am sure many others will agree with me here. – Funk Forty Niner Sep 05 '15 at 20:00

1 Answers1

1

It look OK. You also can use "IN", the you can write i little bit smaler.

SELECT text FROM table WHERE 
text  IN ('$text1', '$text2', '$text3');
Bernd Buffen
  • 14,525
  • 2
  • 24
  • 39