MySQL Algorithm vs Query [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
You find a lot of info on this online. But not what the exact work around of the use of Algorithm is in MySQL. The real basics, if you will..
What a query is, is obvious, of course. What Algorithm does, remains unclear.
Main reason for this question is: to improve profiling & matching records to known users. (In this case: to match docs in a database to users that need them)
Some examples of the usage of it are highly appreciated!

Algorithm is a keyword used with create view in MySQL. The documentation does a pretty good job of explaining it.
The short answer is that MySQL supports two methods of handling views: either "merging" the view definition in the calling code or creating a temporary table. The first is called MERGE and the second TEMPTABLE. In general, MERGE is faster, but most views are TEMPTABLE because of the restrictions on `MERGE.

Related

Multiple-choice test paper in PHP by using Database [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm just a beginner of PHP and I am working for making a multiple-choice type question paper. And I want to stores answers of these question in the database and also want to fetch result from database. And also I want to show result of attempt in percentage e.g. Your result is 40%.
I'm running PHP on WAMP server.
Welcome to Stack Overflow, we are here to help you correct your bugs and help you if you get stuck in coding. We are not freelancers, so please do not ask such questions which literally mean "do my homework!".
But hey, let me give you a basic info on how you should start up. First create a php page with form which contains all questions at once or like a wizard (depends on your needs). Later, you need to create a database, with two tables (maybe more) which are questions and answers. These shouldn't contains huge amounts of html chunks, but should be straight questions and answers with a foreign key to link them. Then use php to generate random questions and answers and use normal post/get (usually not user friendly) or AJAX (better performance).
If you get stuck in any of the steps above, then come back to StackOverflow and share your query with invalid codes and similar. Hoping this was helpful :)

Optimizing search query for multiple search criteria [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a search functionality where I have multiple search criteria like State,District,University,Programme,Level,Courses, Institutes etc. This itself makes 7 search criteria.
I can search using any one search criteria or all or any combination. By this I have to check for all the possibility of search i.e. 2^7 combination using IF-ELSEIF loop.
I want to avoid this method of searching since any day if a new criteria comes up that increases the complexity of code by power of 2. Is there any better algorithm which can be useful to tackle this performance issue with my search.
I am implementing the same using PHP-MySQL.
Regards,
Suvojit
Build your $sql string dynamically with where clause created using php implode. Case solved

Symfony 2 search in hundred thousands rows [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I search for my website developed under Symfony2, what questioned table database of hundreds of thousands of lines 2 columns.
Currently I use FULLIndex and like it, but it takes forever to respond, as this search engine is the very keystone of the site.
It therefore I need a strategy to implement, technical or network to optimize this search on this table and others as large and multiple columns.
Thank you in advance !
If you have a big database and you want to search data in it, I definitely recommend you ElasticSearch
There is a good bundle for this here.
This bundle is maintained by FOS. It's very easy to make it work in a symfony2 project

Performing Functions in MySQL vs. PHP [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I just learned that you can perform loops and things like that directly in MySQL rather than using PHP for them. Which is more efficient hardware-wise? When would it be advantageous to use each over the other?
Thanks!
It is a case of horses for courses. Generally the efficiency of PLSQL is TERRIBLE when compared to the efficiency of a programming language - but if the difference is that you can run one very simple statement in a database and return 100 rows of data, versus returning a million rows of data and processing them all code to get to the same 100 rows... well you see where this is heading.
Generally speaking, it comes down to experience - but most of all it comes down to testing it out for yourself. If you have a long job that you think might be better done in another part of the code, or in another system - write it and test it. See what works better. There simply isn't a "one shoe fits all" answer for this.

Best performance? treat data in DB and get result directly OR get result and then work on it? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a small question about performance during dev (web especially) :
Is it better to :
perform operations directly on the DB and retreive a "ready" result
OR
retreive the data from the DB and then do the operations?
Mat is right (see comments): there is no general answer to that. It depends on the structure of your data, on the queries you want to run and on your database system.
Nevertheless I would say, in most traditional cases it is better to join, filter, group, cumulate and sort your data directly in the DB - just because your DB is built to perform exactly this kind of tasks. If your data structure and indexes are built up right, it will be hard to write code beating the database in terms of performance on this actions.
Indeed, there are complex queries where it is better to split it up and do some work in your code. But unless you have more than 10 tables involved or big sub queries, you should not think about this to much.

Categories