Questions tagged [Optimization of SQL-queries] (37)

2
answers

How to make a sql update statement is better?

You need to make a few hundred update some rows in the table. $views = 'some number'; $q = $pdo->prepare('UPDATE articles SET views=? WHERE id=?'); foreach ($rows AS $id) { $q->execute([$views, $id]); } This is the only solution?
Elisabeth_Bernha asked April 18th 20 at 12:13
2
answers

Optimize mysql query?

We have the following table: matches: id, start_time, tournament_id teams: id, name, logo matches_teams: id, match_id, team_id tournaments: id, name Now full info about the matches are as follows: 1. One get request matches.id matches.start_time, tournaments.name 2. Next cycle for each match of P1 do two more request for t...
Keith.Kun asked April 8th 20 at 17:23
2
answers

A long mysql query that alter?

Hello, tell me how should look this query in the normal way to work quickly? Now it is 6 seconds, if you take in the beginning class_ads.*, 1.5 seconds, but then displays only a few columns, as it is to optimize all select class_ads.*, class_ads.id as adid, date_format(class_ads.`date_added`,'%d.%m PI %H:%i') as date_nice, ...
darwin3 asked April 7th 20 at 09:05
2
answers

How to write optimal SQL query with a calculated field?

Good day, please help to write an optimal SQL query there are three tables:Events Participants Users Accordingly, the user registering for the event to become a party. Participants table implements the many-to-many relation between Events and Users. Noino, given the ID of the user to make a selection of all events and add...
Aimee.Goyette asked April 4th 20 at 13:27
2
answers

Laravel relationship or a regular query with LEFT JOIN?

Friends, help me the old head on the shelves properly stowed. I honestly can't understand the better relationship from a normal request Here is an example, I have 3 tables:payment_services id type_object_id object_id type_service_id type_objects id name translit type_services id name translit where type_object_id foreign...
Donnell.Luettg asked April 3rd 20 at 17:45
2
answers

How to optimize this query?

Hi! How to optimize this query ? The index (primary) on the fields where the join cost. Is the index (status, date_available) and (path_id, category_id). Tried to add a composite index for order by, but it is nothing of the speed boost does not. In oc_category_path and order by uses filesort how to get rid of this ?SELECT ...
lenore_Christiansen asked March 31st 20 at 20:57
1
answer

How to optimize the fetching from database?

Can someone help optimize this query:SELECT q.id FROM questions.question q WHERE NOT EXISTS (SELECT qt.question_id FROM questions.question_translate_it qt WHERE q.id = qt.question_id) AND NOT EXISTS (SELECT true FROM questions.translate_questions tq WHERE q.id = tq.question_id AND tq.language_id = 8) LIMIT 1; it works, bu...
Felicia.Lo asked March 31st 20 at 20:34
1
answer

Optimizing queries the database?

Writing diploma and has a sub - Optimization of database queries. In this matter I'm new, so tell me or tell me where to read about the issue, "the creation of complex queries based on simple in the context of optimization."
lexie asked March 31st 20 at 20:27
1
answer

How to speed up the search?

There is a table about 5 million rows, it's completely static (it does not record and is not editable, read only) which can give advice to accelerate search in the table ? (The only thing we've done is added code) A standard query looks like this: SELECT * FROM words WHERE word = 'Hello'
august_Konopelski76 asked March 31st 20 at 16:25
2
answers

Which index to create for the table?

There is a sign, which contains information about stores - who they are, what region we are, where stored, etc. the List of columns like this: [DivisionNodeName] varchar(100) ,[DSMid] int non-unique ,[DSMname] ,[TSMNodeName] ,[TSMid] int non-unique ,[TSMname] ,[SVNodeName] ,[SVid] int non-unique ,[SVname] ,[TPNode...
Ken_Cruickshank8 asked March 30th 20 at 01:09