CodeIgniter Forums
Mongodb or Mysql - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forum-1.html)
+--- Forum: Lounge (https://forum.codeigniter.com/forum-3.html)
+--- Thread: Mongodb or Mysql (/thread-74311.html)



Mongodb or Mysql - omid_student - 09-09-2019

Hi
I'm programming website with mysql that you can see here https://worldhotelcodes.com
Please search 001h1001
You will see elapse 3 second for search
I have 1 million and 200 thousand records in mysql
Why it is slow?
I was added index on main field
Also i dont use like statment for where condition
Only use WHERE code = '001h1001'

Now i decide use mongodb
Is it good solution or i try optimize mysql?

Also i have other problem
I need make search record on textchange input search that it will be slow if i search record for each character


RE: Mongodb or Mysql - dave friend - 09-09-2019

I searched for '001h1001' many times and it always finished in less than a second. Typically took about 750ms. You have indexed the 'code' field?


RE: Mongodb or Mysql - InsiteFX - 09-09-2019

I also get it under a second, but I am on 150Mbs cable

I did bring up Chrome Developer Tools and it showed these errors:

Code:
jquery-3.3.1.min.js:2 jQuery.Deferred exception: Demo is not defined ReferenceError: Demo is not defined
    at HTMLDocument.<anonymous> (https://worldhotelcodes.com/assets/js/script.js:1:10257)
    at l (https://worldhotelcodes.com/assets/js/jquery-3.3.1.min.js:2:29375)
    at c (https://worldhotelcodes.com/assets/js/jquery-3.3.1.min.js:2:29677) undefined
w.Deferred.exceptionHook @ jquery-3.3.1.min.js:2
c @ jquery-3.3.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
fire @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
ready @ jquery-3.3.1.min.js:2
_ @ jquery-3.3.1.min.js:2
jquery-3.3.1.min.js:2 Uncaught ReferenceError: Demo is not defined
    at HTMLDocument.<anonymous> (script.js:1)
    at l (jquery-3.3.1.min.js:2)
    at c (jquery-3.3.1.min.js:2)
(anonymous) @ script.js:1
l @ jquery-3.3.1.min.js:2
c @ jquery-3.3.1.min.js:2
setTimeout (async)
w.readyException @ jquery-3.3.1.min.js:2
(anonymous) @ jquery-3.3.1.min.js:2
l @ jquery-3.3.1.min.js:2
c @ jquery-3.3.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
fire @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
c @ jquery-3.3.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
fire @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
ready @ jquery-3.3.1.min.js:2
_ @ jquery-3.3.1.min.js:2



RE: Mongodb or Mysql - php_rocs - 09-09-2019

@omid_student,

The search performed very quickly for me (under a second). No issues. My question to you is have you done a database analysis to determine if your queries are efficient? If you have the right indexes?


RE: Mongodb or Mysql - omid_student - 09-09-2019

Hi again
Ommm but my net speed is 1mb,search is slow sometimes about 2 second
Also i need search realtime records on textchanges input textbox
Is it good mysql?
Also i use benchmark and i see it elapsed 2 second for search query


RE: Mongodb or Mysql - InsiteFX - 09-09-2019

If you can run the queries in phpMyAdmin it will tell you how to optimize them.

I would work on optimizing the query first.


RE: Mongodb or Mysql - php_rocs - 09-09-2019

@omid_student,

If you are able to test it with CI profiler turned on ( https://codeigniter.com/user_guide/general/profiling.html?highlight=profiler#profiling-your-application ) this would be very helpful. It would tell you how fast your queries are and how many are being run on the page. You can then take the actual queries and do database analysis in phpMyAdmin or some other MySQL database tool to determine if your query is efficient.


RE: Mongodb or Mysql - omid_student - 09-10-2019

(09-09-2019, 01:48 PM)InsiteFX Wrote: If you can run the queries in phpMyAdmin it will tell you how to optimize them.

I would work on optimizing the query first.

I tried it already
I think one where have problem

(09-09-2019, 05:44 PM)php_rocs Wrote: @omid_student,

If you are able to test it with CI profiler turned on ( https://codeigniter.com/user_guide/general/profiling.html?highlight=profiler#profiling-your-application ) this would be very helpful.  It would tell you how fast your queries are and how many are being run on the page.  You can then take the actual queries and do database analysis in phpMyAdmin or some other MySQL database tool to determine if your query is efficient.

Yes it is good solution
Thanks