CodeIgniter Forums

Full Version: Mongodb or Mysql
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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?
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
@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?
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
If you can run the queries in phpMyAdmin it will tell you how to optimize them.

I would work on optimizing the query first.
@omid_student,

If you are able to test it with CI profiler turned on ( https://codeigniter.com/user_guide/gener...pplication ) 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.
(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/gener...pplication ) 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