Des requêtes à problèmes?

17 septembre 2017

Quand MySQL se me à déraper, c’est habituellement l’oeuvre de quelques requêtes SQL problématiques.  Un petit rappel pour vous aider à trouver la/les coupables!

Publicités

Les plaques du Congo

28 mars 2017

Comment générer une clef séquentielle et incrémentale composée d’une partie numérique et d’un suffixe lettré?

Comme c’est une situation souvent rencontrée et que les gens détestent habituellement s’attaquer aux procédures stockées et/ou évitent d’utiliser leur langage de programmation favori (pour avoir une solution à 100% en SQL), j’ai pensé vous montrer le problème qu’on m’a demandé de résoudre en SQL et ma solution (qui peut facilement être adaptée aux problèmes similaires)…

Dans le cas qui nous intéresse, il s’agit de plaques d’immatriculation de la République du Congo (format CEMAC).


/*
En supposant la définition suivante

CREATE TABLE plaques(plaque VARCHAR(10));

Et le format de plaque d'immatriculation suivant :

RC-0000-AA
RC-0001-AA
...
RC-9999-AA
RC-0000-AB
RC-0001-AB
...
RC-9999-AZ
RC-0000-BA
...
RC-9999-BZ
RC-0000-CA
RC-0001-CA

Comment générer le prochain numéro 
de plaque d'immatriculation disponible?
*/

SELECT 
    CONCAT(prefixe, 
          '-', 
          LPAD(IF(numero=9999, 0, numero+1), 4, '0'), 
          '-', 
          IF(numero=9999, prochain_suffixe, suffixe)
    ) AS nouvelle_plaque
FROM
(
SELECT 
    MID(plaque, 1, 2) AS prefixe, 
    (MID(plaque, 4, 4) + 0) AS numero, 
    MID(plaque, 9, 2) AS suffixe, 
    IF( MID(plaque, 10, 1)='Z', 
        CONCAT(CHAR(ASCII(MID(plaque, 9, 1)) + 1), 'A'), 
        CONCAT(MID(plaque, 9, 1), CHAR(ASCII(MID(plaque, 10, 1)) + 1))
    ) AS prochain_suffixe
FROM 
    plaques
ORDER BY 
    suffixe DESC, numero DESC
LIMIT 1
) t


What’s new?

19 juillet 2016

What’s new?

After a major data loss (I haven’t given up on getting back all my data, mostly code repositories and databases!), I had to start all my pet projects from scratch. Luckily, it’s easier second time around as they say! And, lucky me, I store all my personal stuff on the web! So here’s a list of what’s coming up on this blog.

Ruzzle

Even though I had a decent working version of the genetic algorithm program to find the best ruzzle grid (original posts in French here, here and here), I wasn’t satisfied with the code.  It slowly evolved from a bunch of code snippets into something I could somehow call a genetic algorithm.  Problem was that my solution was tailored for this specific problem only!  Since I lost all the Smalltalk code, I redid the whole thing from scratch : better design, simpler API, more flexible framework.  I can currently solve a TSP problem, the best ruzzle grid search and a diophantine equation.

I also plan to provide examples of the 8 queens problem, the knapsack problem, a quadratic equation problem, a resource-constrained problem and a simple bit-based example with the GA framework.  Besides, the are now more selection operators, more crossover operators, more termination detectors (as well as support for sets of termination criteria!), cleaner code and the list goes on!  So I’ll soon publish a GA framework for Pharo.

As most of you know, the Rush fan in me had to pick a project name in some way related to my favorite band!  So the framework will be called Freewill, for the lyrics in the song :

Each of us
A cell of awareness
Imperfect and incomplete
Genetic blends
With uncertain ends
On a fortune hunt that’s far too fleet

Bingo

A stupid quest I’ll address after the first version of my GA framework is published.  It all started with a simple question related to the game of bingo (don’t ask!) : can we estimate the number of bingo cards sold in an event based on how many numbers it takes for each card configuration to have a winner?  So it’s just a matter of generating millions of draws and cards à la Monte Carlo and averaging how many numbers it takes for every configuration.  Why am I doing that?  Just because I’m curious!

Glorp

There’s been a lot of action on the Pharo side and Glorp.  I plan on having a serious look at the latest Glorp/Pharo combo and even participate to the development!

Sudoku

I’ll translate my articles (in French here, here and here) on the SQL sudoku solver in English and test the whole thing on the latest MySQL server.  Besides, db4free has upgraded to a new MySQL server version!

NeoCSV

I had done a port of NeoCSV to Dolphin right before losing all my code data.  Wasn’t hard to port so I’ll redo it as soon as I reinstall Dolphin!

Smalltalk

It’s time to reinstall VisualAge, VisualWorks, Squeak, ObjectStudio and Dolphin and see what’s new in each environment!  From what I saw, there’s a lot of new and interesting stuff on the web side.  Add to that the fact that most social media platforms have had significant changes in their respective APIs recently, so there’s a lot to learn there!

 

That’s a wrap folks!


Les meilleurs par groupe

10 janvier 2016

C’est une question à laquelle je réponds fréquemment dans #mysql sur IRC : comment puis-je faire pour trouver les N meilleurs par groupe avec leur rang?

C’est un problème fréquent qui se présente de différentes manières et qui comporte certaines difficultés en SQL.

Quels sont les 5 meilleurs scoreurs par équipe et leur rang?  Quels sont les 3 meilleurs vendeurs par magasin et leur rang? Quelles sont les 10 villes les plus populeuses par pays et leur rang?

L’histoire se complique habituellement quand vient le temps de déterminer le rang des meneurs de chaque groupe.

J’ai expliqué la solution à ce problème des dizaines de fois! C’est long, pénible et jamais simple…

Mais je suis récemment tombé sur un excellent article dédié à ce problème : SQL: Getting TOP N rows for a grouped query.

C’est, de loin, l’explication la plus claire et simple que j’ai vu à ce problème. Un genre de tutoriel pas à pas d’une efficacité redoutable.

Je sens que je vais dorénavant me sauver bien du temps!

 


Cumulatif

4 mars 2015

Calculer des totaux et des cumulatifs, ça peut surtout se faire en SQL!


Comment presser un citron (troisième partie)

27 mai 2013

1. Un problème n’arrive jamais seul

Dans la deuxième partie de cet article (le premier article étant ici), nous nous sommes laissés sur un exemple extrême (i.e. une grille avec des lignes et des colonnes vides) afin de vérifier la validité et l’efficacité de la solution présentée dans un des pires scénarios envisageable :

Avant même de débuter, rappelez-vous qu’il est primordial d’exécuter la commande suivante dans votre session pour éviter d’avoir à attendre une éternité, que ce soit pour la requête SQL ou pour un EXPLAIN!

set @@optimizer_search_depth = 3;

Qu’arriverait-il si nous avions à solutionner un sudoku contenant à la fois des lignes et des colonnes vides, comme dans l’exemple ci-haut avec la requête suivante:

SELECT *
FROM sudoku_combined_view
WHERE
(r2c2 = 3) AND (r2c3 = 4) AND (r2c4 = 8) AND (r2c5 = 2) AND
(r2c6 = 5) AND (r2c7 = 6) AND (r2c8 = 9) AND (r3c2 = 5) AND
(r3c3 = 9) AND (r3c4 = 3) AND (r3c5 = 6) AND (r3c6 = 4) AND
(r3c7 = 1) AND (r3c8 = 8) AND (r4c2 = 9) AND (r4c3 = 7) AND
(r4c4 = 1) AND (r4c5 = 8) AND (r4c6 = 2) AND (r4c7 = 5) AND
(r4c8 = 6) AND (r6c2 = 8) AND (r6c3 = 1) AND (r6c4 = 4) AND
(r6c5 = 7) AND (r6c6 = 6) AND (r6c7 = 2) AND (r6c8 = 3) AND
(r7c2 = 2) AND (r7c3 = 5) AND (r7c4 = 6) AND (r7c5 = 4) AND
(r7c6 = 1) AND (r7c7 = 9) AND (r7c8 = 7) AND (r8c2 = 7) AND
(r8c3 = 6) AND (r8c4 = 5) AND (r8c5 = 3) AND (r8c6 = 8) AND
(r8c7 = 4) AND (r8c8 = 2);

Examinons le résultat du EXPLAIN pour la grille en question:

+----+-------------+-------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-------------+---------+-------------------------------+------+----------------------------------------------------------+
| id | select_type | table | type        | possible_keys                                                                                                                                      | key         | key_len | ref                           | rows | Extra                                                    |
+----+-------------+-------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-------------+---------+-------------------------------+------+----------------------------------------------------------+
|  1 | SIMPLE      | col3  | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i23,i38,i48 | 2,2,2   | NULL                          |   64 | Using intersect(i23,i38,i48); Using where                |
|  1 | SIMPLE      | r2    | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i23,i58     | 2,2     | NULL                          |   68 | Using intersect(i23,i58); Using where; Using join buffer |
|  1 | SIMPLE      | r3    | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i78,i56     | 2,2     | NULL                          |   68 | Using intersect(i78,i56); Using where; Using join buffer |
|  1 | SIMPLE      | r4    | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i38,i46     | 2,2     | NULL                          |   68 | Using intersect(i38,i46); Using where; Using join buffer |
|  1 | SIMPLE      | r6    | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i23,i67     | 2,2     | NULL                          |   68 | Using intersect(i23,i67); Using where; Using join buffer |
|  1 | SIMPLE      | r7    | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i38,i56     | 2,2     | NULL                          |   68 | Using intersect(i38,i56); Using where; Using join buffer |
|  1 | SIMPLE      | r8    | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i23,i68     | 2,2     | NULL                          |   68 | Using intersect(i23,i68); Using where; Using join buffer |
|  1 | SIMPLE      | col2  | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i23,i68     | 2,2     | NULL                          |   68 | Using intersect(i23,i68); Using where; Using join buffer |
|  1 | SIMPLE      | col4  | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i78,i46     | 2,2     | NULL                          |   68 | Using intersect(i78,i46); Using where; Using join buffer |
|  1 | SIMPLE      | col5  | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i23,i68     | 2,2     | NULL                          |   68 | Using intersect(i23,i68); Using where; Using join buffer |
|  1 | SIMPLE      | col6  | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i23,i67     | 2,2     | NULL                          |   68 | Using intersect(i23,i67); Using where; Using join buffer |
|  1 | SIMPLE      | col7  | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i23,i68     | 2,2     | NULL                          |   68 | Using intersect(i23,i68); Using where; Using join buffer |
|  1 | SIMPLE      | col8  | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i37,i24     | 2,2     | NULL                          |   68 | Using intersect(i37,i24); Using where; Using join buffer |
|  1 | SIMPLE      | col1  | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i23         | 2       | sudoku.r2.c1,sudoku.r3.c1     | 5040 | Using where                                              |
|  1 | SIMPLE      | r1    | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12         | 2       | sudoku.col1.c1,sudoku.col2.c1 | 5040 | Using where                                              |
|  1 | SIMPLE      | r5    | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12         | 2       | sudoku.col1.c5,sudoku.col2.c5 | 5040 | Using where                                              |
|  1 | SIMPLE      | r9    | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12         | 2       | sudoku.col1.c9,sudoku.col2.c9 | 5040 | Using where                                              |
|  1 | SIMPLE      | col9  | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12         | 2       | sudoku.r1.c9,sudoku.r2.c9     | 5040 | Using where                                              |
+----+-------------+-------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-------------+---------+-------------------------------+------+----------------------------------------------------------+
18 rows in set (0.20 sec)

À première vue, tout semble correct! Aucun table scan et les indexes sont utilisés pour chaque colonne et chaque rangée non vide!

Et en combien de temps MySQL peut-il « solutionner » cette grille ?

Fantastique!  1.5 seconde!  Tout est réglé!  Malheureusement, non…

2. Le pire scénario possible

Il existe une catégorie de sudokus que nombre de mathématiciens et d’informaticiens étudient depuis des années : ces grilles minimales n’ont seulement que 17 révélés, le minimum théorique (une conjecture encore non prouvée de façon mathématique par Gary McGuire, Bastian Tugemann et Gilles Civario, un autre intéressant article ici) pouvant mener à une solution unique.  Plusieurs de ces grilles spéciales (17 révélés) sont depuis des années compilées par Gordon Royle, professeur à l’université d’Australie Occidentale.

Comme celle-ci :

Vous remarquerez que cette grille ne contient aucune ligne ni aucune colonne vide! Essayons donc de voir en combien de temps MySQL pourra résoudre celle-ci :

mysql> SELECT *
 -> FROM sudoku_combined_view
 -> WHERE
 -> (r1c8 = 1) AND
 -> (r2c1 = 4) AND
 -> (r3c2 = 2) AND
 -> (r4c5 = 5) AND
 -> (r4c7 = 4) AND
 -> (r4c9 = 7) AND
 -> (r5c3 = 8) AND
 -> (r5c7 = 3) AND
 -> (r6c3 = 1) AND
 -> (r6c5 = 9) AND
 -> (r7c1 = 3) AND
 -> (r7c4 = 4) AND
 -> (r7c7 = 2) AND
 -> (r8c2 = 5) AND
 -> (r8c4 = 1) AND
 -> (r9c4 = 8) AND
 -> (r9c6 = 6);
+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| r1c1 | r1c2 | r1c3 | r1c4 | r1c5 | r1c6 | r1c7 | r1c8 | r1c9 | r2c1 | r2c2 | r2c3 | r2c4 | r2c5 | r2c6 | r2c7 | r2c8 | r2c9 | r3c1 | r3c2 | r3c3 | r3c4 | r3c5 | r3c6 | r3c7 | r3c8 | r3c9 | r4c1 | r4c2 | r4c3 | r4c4 | r4c5 | r4c6 | r4c7 | r4c8 | r4c9 | r5c1 | r5c2 | r5c3 | r5c4 | r5c5 | r5c6 | r5c7 | r5c8 | r5c9 | r6c1 | r6c2 | r6c3 | r6c4 | r6c5 | r6c6 | r6c7 | r6c8 | r6c9 | r7c1 | r7c2 | r7c3 | r7c4 | r7c5 | r7c6 | r7c7 | r7c8 | r7c9 | r8c1 | r8c2 | r8c3 | r8c4 | r8c5 | r8c6 | r8c7 | r8c8 | r8c9 | r9c1 | r9c2 | r9c3 | r9c4 | r9c5 | r9c6 | r9c7 | r9c8 | r9c9 |
+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
|   6  |   9  |   3  |   7  |   8  |   4  |   5  |   1  |   2  |   4  |   8  |   7  |   5  |   1  |   2  |   9  |   3  |   6  |   1  |   2  |   5  |   9  |   6  |   3  |   8  |   7  |   4  |   9  |   3  |   2  |   6  |   5  |   1  |   4  |   8  |   7  |   5  |   6  |   8  |   2  |   4  |   7  |   3  |   9  |   1  |   7  |   4  |   1  |   3  |   9  |   8  |   6  |   2  |   5  |   3  |   1  |   9  |   4  |   7  |   5  |   2  |   6  |   8  |   8  |   5  |   6  |   1  |   2  |   9  |   7  |   4  |   3  |   2  |   7  |   4  |   8  |   3  |   6  |   1  |   5  |   9  |
+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
1 row in set (2 min 20.83 sec)

Ouch!  Je ne suis pas arrivé à descendre sour la barre des 40 secondes malgré mes tentatives répétées et ce, sur différents serveurs avec différentes configurations (et même différentes autres grilles de 17 révélés). Les résultats pour solutionner cette grille vont de près de 40 secondes à plus de 33 minutes. Le résultat du EXPLAIN parle par lui-même :

+----+-------------+-------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+-------------------------------+------+----------------------------------------------------------+
| id | select_type | table | type        | possible_keys                                                                                                                                      | key     | key_len | ref                           | rows | Extra                                                    |
+----+-------------+-------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+-------------------------------+------+----------------------------------------------------------+
|  1 | SIMPLE      | r4    | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i57,i59 | 2,2     | NULL                          |  624 | Using intersect(i57,i59); Using where                    |
|  1 | SIMPLE      | r7    | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i14,i47 | 2,2     | NULL                          |  624 | Using intersect(i14,i47); Using where; Using join buffer |
|  1 | SIMPLE      | col4  | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i78,i89 | 2,2     | NULL                          |  624 | Using intersect(i78,i89); Using where; Using join buffer |
|  1 | SIMPLE      | col7  | index_merge | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i45,i47 | 2,2     | NULL                          |  624 | Using intersect(i45,i47); Using where; Using join buffer |
|  1 | SIMPLE      | r8    | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i24     | 2       | const,const                   | 5000 | Using where                                              |
|  1 | SIMPLE      | r9    | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i46     | 2       | const,const                   | 5001 | Using where                                              |
|  1 | SIMPLE      | col1  | range       | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i27     | 2       | NULL                          | 5000 | Using where; Using join buffer                           |
|  1 | SIMPLE      | r5    | range       | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i37     | 2       | NULL                          | 5001 | Using where; Using join buffer                           |
|  1 | SIMPLE      | r6    | range       | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i35     | 2       | NULL                          | 5001 | Using where; Using join buffer                           |
|  1 | SIMPLE      | col3  | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i45     | 2       | sudoku.r4.c3,const            | 5040 | Using where                                              |
|  1 | SIMPLE      | col2  | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i34     | 2       | const,sudoku.r4.c2            | 5040 | Using where                                              |
|  1 | SIMPLE      | r2    | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12     | 2       | const,sudoku.col2.c2          | 5040 | Using where                                              |
|  1 | SIMPLE      | col5  | range       | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i46     | 2       | NULL                          | 5001 | Using where; Using join buffer                           |
|  1 | SIMPLE      | r3    | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12     | 2       | sudoku.col1.c3,const          | 5040 | Using where                                              |
|  1 | SIMPLE      | col8  | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12     | 2       | const,sudoku.r2.c8            | 5040 | Using where                                              |
|  1 | SIMPLE      | r1    | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12     | 2       | sudoku.col1.c1,sudoku.col2.c1 | 5040 | Using where                                              |
|  1 | SIMPLE      | col9  | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12     | 2       | sudoku.r1.c9,sudoku.r2.c9     | 5040 | Using where                                              |
|  1 | SIMPLE      | col6  | ref         | i12,i13,i14,i15,i16,i17,i18,i19,i23,i24,i25,i26,i27,i28,i29,i34,i35,i36,i37,i38,i39,i45,i46,i47,i48,i49,i56,i57,i58,i59,i67,i68,i69,i78,i79,i89,i9 | i12     | 2       | sudoku.r1.c6,sudoku.r2.c6     | 5040 | Using where                                              |
+----+-------------+-------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+-------------------------------+------+----------------------------------------------------------+
18 rows in set (2.59 sec)

Observez la colonne rows dans le résultat du EXPLAIN pour comprendre le nombre astronomique de jointures possibles que MySQL aura à effectuer et à tester…  Dans la très grande majorité des cas, ce chiffre est supérieur à 5000!

Il devient maintenant évident que notre solution ne tient plus la route…

3. Ne pas céder au découragement!

Il existe bon nombre d’autres possibilités d’optimisations que nous n’avons toujours pas envisagées.  Par exemple, dans certains cas il pourrait être avantageux de chercher par boîtes (carré de 3×3 dans le sudoku).  Certaines grilles de 17 révélés pourraient grandement en bénéficier mais il nous faudrait alors joindre 27 tables!  Ce qui est gagné d’un côté est perdu de l’autre.

Nous pourrions également créer des partitions mais dans ce cas, quelles seraient les chances qu’une colonne ou une rangée contienne la donnée permettant de discriminer et de choisir la partition requise?

Nous pourrions augmenter la taille de l’index pour passer de 2 colones à 3 mais l’impact de cette mesure serait inutile pour les grilles de 17 révélés.

Qu’arriverait-il si nous passions du format de table MyISAM à InnoDb ?  Absolument rien, le problème demeure entier : MySQL n’est pas assez rapide pour lire les données (ou les indexes) sur disque puis les joindre efficacement dans un cas aussi extrême.

L’idée à la base de cette série d’article était d’arriver à solutionner un sudoku valide en n’utilisant que du SQL.  Un sudoku valide, par définition, a une seule solution.  Nous aurions pu ajouter LIMIT 1 à chacune de nos vues mais hélas, ce faisant, nos vues seraient contraintes d’utiliser l’algorithme TEMPTABLE au lieu de MERGE, ce qui serait catastrophique!

Évidemment, quelques autres astuces existent, comme augmenter la taille des variables key_buffer_size et join_buffer_size, diminuer la valeur du optimizer_search_depth, etc.  Évidemment dans le cas des 2 premières variables, je ne peux rien vous suggérer comme ces paramètres dépendent de la mémoire RAM disponible sur votre machine, le système d’exploitation utilisé, etc.  Quant à la valeur de la variable optimizer_search_depth, diminuer celle-ci n’aura pas d’impact significatif comme le problème réside dans la lenteur des accès au disque dur et au nombre effarant de jointures et de rangées à examnier (et à retrouver puis lire).

4. Éplucher toutes les options

Il existe un type de table, MEMORY, en MySQL qui nous permettrait d’éviter d’avoir à lire les données (ou les indexes) sur disque, ce qui pourrait avoir un impact majeur dans notre cas.  Nous allons donc créer cette table en mémoire et la remplir tout en créant les indexes nécessaires (exactement les mêmes vues et indexes que la table de format MyISAM).

Mais avant de procéder, prenez bien soin de vous assurez que la variable max_heap_table_size soit supérieure à 216Mb ( 226492416) sinon vous vous heurterez à une tonne d’erreurs 1114 (table full).  Si ce n’est pas le cas, vous pouvez fixer la valeur de cette variable à 216Mb comme suit :

set @@max_heap_table_size =  226492416;

Une fois cette précaution prise, construisez la table et les indexes nécessaires comme suit:

USE sudoku;

DROP TABLE IF EXISTS positions_memory;
CREATE TABLE positions_memory (
 c1 TINYINT UNSIGNED NOT NULL,
 c2 TINYINT UNSIGNED NOT NULL,
 c3 TINYINT UNSIGNED NOT NULL,
 c4 TINYINT UNSIGNED NOT NULL,
 c5 TINYINT UNSIGNED NOT NULL,
 c6 TINYINT UNSIGNED NOT NULL,
 c7 TINYINT UNSIGNED NOT NULL,
 c8 TINYINT UNSIGNED NOT NULL,
 c9 TINYINT UNSIGNED NOT NULL
) ENGINE=MEMORY;

INSERT INTO positions_memory (c1, c2, c3, c4, c5, c6, c7, c8, c9)
SELECT c1, c2, c3, c4, c5, c6, c7, c8, c9 FROM positions;

CREATE INDEX i12 ON positions_memory(c1, c2) USING HASH; CREATE INDEX i13 ON positions_memory(c1, c3) USING HASH;
CREATE INDEX i14 ON positions_memory(c1, c4) USING HASH; CREATE INDEX i15 ON positions_memory(c1, c5) USING HASH;
CREATE INDEX i16 ON positions_memory(c1, c6) USING HASH; CREATE INDEX i17 ON positions_memory(c1, c7) USING HASH;
CREATE INDEX i18 ON positions_memory(c1, c8) USING HASH; CREATE INDEX i19 ON positions_memory(c1, c9) USING HASH;
CREATE INDEX i23 ON positions_memory(c2, c3) USING HASH; CREATE INDEX i24 ON positions_memory(c2, c4) USING HASH;
CREATE INDEX i25 ON positions_memory(c2, c5) USING HASH; CREATE INDEX i26 ON positions_memory(c2, c6) USING HASH;
CREATE INDEX i27 ON positions_memory(c2, c7) USING HASH; CREATE INDEX i28 ON positions_memory(c2, c8) USING HASH;
CREATE INDEX i29 ON positions_memory(c2, c9) USING HASH; CREATE INDEX i34 ON positions_memory(c3, c4) USING HASH;
CREATE INDEX i35 ON positions_memory(c3, c5) USING HASH; CREATE INDEX i36 ON positions_memory(c3, c6) USING HASH;
CREATE INDEX i37 ON positions_memory(c3, c7) USING HASH; CREATE INDEX i38 ON positions_memory(c3, c8) USING HASH;
CREATE INDEX i39 ON positions_memory(c3, c9) USING HASH; CREATE INDEX i45 ON positions_memory(c4, c5) USING HASH;
CREATE INDEX i46 ON positions_memory(c4, c6) USING HASH; CREATE INDEX i47 ON positions_memory(c4, c7) USING HASH;
CREATE INDEX i48 ON positions_memory(c4, c8) USING HASH; CREATE INDEX i49 ON positions_memory(c4, c9) USING HASH;
CREATE INDEX i56 ON positions_memory(c5, c6) USING HASH; CREATE INDEX i57 ON positions_memory(c5, c7) USING HASH;
CREATE INDEX i58 ON positions_memory(c5, c8) USING HASH; CREATE INDEX i59 ON positions_memory(c5, c9) USING HASH;
CREATE INDEX i67 ON positions_memory(c6, c7) USING HASH; CREATE INDEX i68 ON positions_memory(c6, c8) USING HASH;
CREATE INDEX i69 ON positions_memory(c6, c9) USING HASH; CREATE INDEX i78 ON positions_memory(c7, c8) USING HASH;
CREATE INDEX i79 ON positions_memory(c7, c9) USING HASH; CREATE INDEX i89 ON positions_memory(c8, c9) USING HASH;
CREATE INDEX i9 ON positions_memory(c9) USING HASH;

Maintenant, il s’agit de recréer les trois mêmes vues que nous avons créées pour le type de table MYISAM mais pour notre nouvelle table.

En premier lieu, la vue sur les rangées.

USE sudoku;

DROP VIEW IF EXISTS sudoku_memory_rows_view;
CREATE VIEW sudoku_memory_rows_view AS
SELECT
r1.c1 as r1c1, r1.c2 as r1c2, r1.c3 as r1c3, r1.c4 as r1c4, r1.c5 as r1c5, r1.c6 as r1c6, r1.c7 as r1c7, r1.c8 as r1c8, r1.c9 as r1c9, r2.c1 as r2c1,
r2.c2 as r2c2, r2.c3 as r2c3, r2.c4 as r2c4, r2.c5 as r2c5, r2.c6 as r2c6, r2.c7 as r2c7, r2.c8 as r2c8, r2.c9 as r2c9, r3.c1 as r3c1, r3.c2 as r3c2,
r3.c3 as r3c3, r3.c4 as r3c4, r3.c5 as r3c5, r3.c6 as r3c6, r3.c7 as r3c7, r3.c8 as r3c8, r3.c9 as r3c9, r4.c1 as r4c1, r4.c2 as r4c2, r4.c3 as r4c3,
r4.c4 as r4c4, r4.c5 as r4c5, r4.c6 as r4c6, r4.c7 as r4c7, r4.c8 as r4c8, r4.c9 as r4c9, r5.c1 as r5c1, r5.c2 as r5c2, r5.c3 as r5c3, r5.c4 as r5c4,
r5.c5 as r5c5, r5.c6 as r5c6, r5.c7 as r5c7, r5.c8 as r5c8, r5.c9 as r5c9, r6.c1 as r6c1, r6.c2 as r6c2, r6.c3 as r6c3, r6.c4 as r6c4, r6.c5 as r6c5,
r6.c6 as r6c6, r6.c7 as r6c7, r6.c8 as r6c8, r6.c9 as r6c9, r7.c1 as r7c1, r7.c2 as r7c2, r7.c3 as r7c3, r7.c4 as r7c4, r7.c5 as r7c5, r7.c6 as r7c6,
r7.c7 as r7c7, r7.c8 as r7c8, r7.c9 as r7c9, r8.c1 as r8c1, r8.c2 as r8c2, r8.c3 as r8c3, r8.c4 as r8c4, r8.c5 as r8c5, r8.c6 as r8c6, r8.c7 as r8c7,
r8.c8 as r8c8, r8.c9 as r8c9, r9.c1 as r9c1, r9.c2 as r9c2, r9.c3 as r9c3, r9.c4 as r9c4, r9.c5 as r9c5, r9.c6 as r9c6, r9.c7 as r9c7, r9.c8 as r9c8,
r9.c9 as r9c9

FROM
positions_memory r1, positions_memory r2, positions_memory r3,
positions_memory r4, positions_memory r5, positions_memory r6,
positions_memory r7, positions_memory r8, positions_memory r9

WHERE
-- Nombres uniques dans chaque colonne
(r1.c1 <> r2.c1) AND (r1.c1 <> r3.c1) AND (r1.c1 <> r4.c1) AND (r1.c1 <> r5.c1) AND (r1.c1 <> r6.c1) AND (r1.c1 <> r7.c1) AND (r1.c1 <> r8.c1) AND (r1.c1 <> r9.c1) AND (r1.c2 <> r2.c2) AND (r1.c2 <> r3.c2) AND (r1.c2 <> r4.c2) AND (r1.c2 <> r5.c2) AND (r1.c2 <> r6.c2) AND (r1.c2 <> r7.c2) AND (r1.c2 <> r8.c2) AND (r1.c2 <> r9.c2) AND
(r1.c3 <> r2.c3) AND (r1.c3 <> r3.c3) AND (r1.c3 <> r4.c3) AND (r1.c3 <> r5.c3) AND (r1.c3 <> r6.c3) AND (r1.c3 <> r7.c3) AND (r1.c3 <> r8.c3) AND (r1.c3 <> r9.c3) AND (r1.c4 <> r2.c4) AND (r1.c4 <> r3.c4) AND (r1.c4 <> r4.c4) AND (r1.c4 <> r5.c4) AND (r1.c4 <> r6.c4) AND (r1.c4 <> r7.c4) AND (r1.c4 <> r8.c4) AND (r1.c4 <> r9.c4) AND
(r1.c5 <> r2.c5) AND (r1.c5 <> r3.c5) AND (r1.c5 <> r4.c5) AND (r1.c5 <> r5.c5) AND (r1.c5 <> r6.c5) AND (r1.c5 <> r7.c5) AND (r1.c5 <> r8.c5) AND (r1.c5 <> r9.c5) AND (r1.c6 <> r2.c6) AND (r1.c6 <> r3.c6) AND (r1.c6 <> r4.c6) AND (r1.c6 <> r5.c6) AND (r1.c6 <> r6.c6) AND (r1.c6 <> r7.c6) AND (r1.c6 <> r8.c6) AND (r1.c6 <> r9.c6) AND
(r1.c7 <> r2.c7) AND (r1.c7 <> r3.c7) AND (r1.c7 <> r4.c7) AND (r1.c7 <> r5.c7) AND (r1.c7 <> r6.c7) AND (r1.c7 <> r7.c7) AND (r1.c7 <> r8.c7) AND (r1.c7 <> r9.c7) AND (r1.c8 <> r2.c8) AND (r1.c8 <> r3.c8) AND (r1.c8 <> r4.c8) AND (r1.c8 <> r5.c8) AND (r1.c8 <> r6.c8) AND (r1.c8 <> r7.c8) AND (r1.c8 <> r8.c8) AND (r1.c8 <> r9.c8) AND
(r1.c9 <> r2.c9) AND (r1.c9 <> r3.c9) AND (r1.c9 <> r4.c9) AND (r1.c9 <> r5.c9) AND (r1.c9 <> r6.c9) AND (r1.c9 <> r7.c9) AND (r1.c9 <> r8.c9) AND (r1.c9 <> r9.c9) AND (r2.c1 <> r3.c1) AND (r2.c1 <> r4.c1) AND (r2.c1 <> r5.c1) AND (r2.c1 <> r6.c1) AND (r2.c1 <> r7.c1) AND (r2.c1 <> r8.c1) AND (r2.c1 <> r9.c1) AND (r2.c2 <> r3.c2) AND
(r2.c2 <> r4.c2) AND (r2.c2 <> r5.c2) AND (r2.c2 <> r6.c2) AND (r2.c2 <> r7.c2) AND (r2.c2 <> r8.c2) AND (r2.c2 <> r9.c2) AND (r2.c3 <> r3.c3) AND (r2.c3 <> r4.c3) AND (r2.c3 <> r5.c3) AND (r2.c3 <> r6.c3) AND (r2.c3 <> r7.c3) AND (r2.c3 <> r8.c3) AND (r2.c3 <> r9.c3) AND (r2.c4 <> r3.c4) AND (r2.c4 <> r4.c4) AND (r2.c4 <> r5.c4) AND
(r2.c4 <> r6.c4) AND (r2.c4 <> r7.c4) AND (r2.c4 <> r8.c4) AND (r2.c4 <> r9.c4) AND (r2.c5 <> r3.c5) AND (r2.c5 <> r4.c5) AND (r2.c5 <> r5.c5) AND (r2.c5 <> r6.c5) AND (r2.c5 <> r7.c5) AND (r2.c5 <> r8.c5) AND (r2.c5 <> r9.c5) AND (r2.c6 <> r3.c6) AND (r2.c6 <> r4.c6) AND (r2.c6 <> r5.c6) AND (r2.c6 <> r6.c6) AND (r2.c6 <> r7.c6) AND
(r2.c6 <> r8.c6) AND (r2.c6 <> r9.c6) AND (r2.c7 <> r3.c7) AND (r2.c7 <> r4.c7) AND (r2.c7 <> r5.c7) AND (r2.c7 <> r6.c7) AND (r2.c7 <> r7.c7) AND (r2.c7 <> r8.c7) AND (r2.c7 <> r9.c7) AND (r2.c8 <> r3.c8) AND (r2.c8 <> r4.c8) AND (r2.c8 <> r5.c8) AND (r2.c8 <> r6.c8) AND (r2.c8 <> r7.c8) AND (r2.c8 <> r8.c8) AND (r2.c8 <> r9.c8) AND
(r2.c9 <> r3.c9) AND (r2.c9 <> r4.c9) AND (r2.c9 <> r5.c9) AND (r2.c9 <> r6.c9) AND (r2.c9 <> r7.c9) AND (r2.c9 <> r8.c9) AND (r2.c9 <> r9.c9) AND (r3.c1 <> r4.c1) AND (r3.c1 <> r5.c1) AND (r3.c1 <> r6.c1) AND (r3.c1 <> r7.c1) AND (r3.c1 <> r8.c1) AND (r3.c1 <> r9.c1) AND (r3.c2 <> r4.c2) AND (r3.c2 <> r5.c2) AND (r3.c2 <> r6.c2) AND
(r3.c2 <> r7.c2) AND (r3.c2 <> r8.c2) AND (r3.c2 <> r9.c2) AND (r3.c3 <> r4.c3) AND (r3.c3 <> r5.c3) AND (r3.c3 <> r6.c3) AND (r3.c3 <> r7.c3) AND (r3.c3 <> r8.c3) AND (r3.c3 <> r9.c3) AND (r3.c4 <> r4.c4) AND (r3.c4 <> r5.c4) AND (r3.c4 <> r6.c4) AND (r3.c4 <> r7.c4) AND (r3.c4 <> r8.c4) AND (r3.c4 <> r9.c4) AND (r3.c5 <> r4.c5) AND
(r3.c5 <> r5.c5) AND (r3.c5 <> r6.c5) AND (r3.c5 <> r7.c5) AND (r3.c5 <> r8.c5) AND (r3.c5 <> r9.c5) AND (r3.c6 <> r4.c6) AND (r3.c6 <> r5.c6) AND (r3.c6 <> r6.c6) AND (r3.c6 <> r7.c6) AND (r3.c6 <> r8.c6) AND (r3.c6 <> r9.c6) AND (r3.c7 <> r4.c7) AND (r3.c7 <> r5.c7) AND (r3.c7 <> r6.c7) AND (r3.c7 <> r7.c7) AND (r3.c7 <> r8.c7) AND
(r3.c7 <> r9.c7) AND (r3.c8 <> r4.c8) AND (r3.c8 <> r5.c8) AND (r3.c8 <> r6.c8) AND (r3.c8 <> r7.c8) AND (r3.c8 <> r8.c8) AND (r3.c8 <> r9.c8) AND (r3.c9 <> r4.c9) AND (r3.c9 <> r5.c9) AND (r3.c9 <> r6.c9) AND (r3.c9 <> r7.c9) AND (r3.c9 <> r8.c9) AND (r3.c9 <> r9.c9) AND (r4.c1 <> r5.c1) AND (r4.c1 <> r6.c1) AND (r4.c1 <> r7.c1) AND
(r4.c1 <> r8.c1) AND (r4.c1 <> r9.c1) AND (r4.c2 <> r5.c2) AND (r4.c2 <> r6.c2) AND (r4.c2 <> r7.c2) AND (r4.c2 <> r8.c2) AND (r4.c2 <> r9.c2) AND (r4.c3 <> r5.c3) AND (r4.c3 <> r6.c3) AND (r4.c3 <> r7.c3) AND (r4.c3 <> r8.c3) AND (r4.c3 <> r9.c3) AND (r4.c4 <> r5.c4) AND (r4.c4 <> r6.c4) AND (r4.c4 <> r7.c4) AND (r4.c4 <> r8.c4) AND
(r4.c4 <> r9.c4) AND (r4.c5 <> r5.c5) AND (r4.c5 <> r6.c5) AND (r4.c5 <> r7.c5) AND (r4.c5 <> r8.c5) AND (r4.c5 <> r9.c5) AND (r4.c6 <> r5.c6) AND (r4.c6 <> r6.c6) AND (r4.c6 <> r7.c6) AND (r4.c6 <> r8.c6) AND (r4.c6 <> r9.c6) AND (r4.c7 <> r5.c7) AND (r4.c7 <> r6.c7) AND (r4.c7 <> r7.c7) AND (r4.c7 <> r8.c7) AND (r4.c7 <> r9.c7) AND
(r4.c8 <> r5.c8) AND (r4.c8 <> r6.c8) AND (r4.c8 <> r7.c8) AND (r4.c8 <> r8.c8) AND (r4.c8 <> r9.c8) AND (r4.c9 <> r5.c9) AND (r4.c9 <> r6.c9) AND (r4.c9 <> r7.c9) AND (r4.c9 <> r8.c9) AND (r4.c9 <> r9.c9) AND (r5.c1 <> r6.c1) AND (r5.c1 <> r7.c1) AND (r5.c1 <> r8.c1) AND (r5.c1 <> r9.c1) AND (r5.c2 <> r6.c2) AND (r5.c2 <> r7.c2) AND
(r5.c2 <> r8.c2) AND (r5.c2 <> r9.c2) AND (r5.c3 <> r6.c3) AND (r5.c3 <> r7.c3) AND (r5.c3 <> r8.c3) AND (r5.c3 <> r9.c3) AND (r5.c4 <> r6.c4) AND (r5.c4 <> r7.c4) AND (r5.c4 <> r8.c4) AND (r5.c4 <> r9.c4) AND (r5.c5 <> r6.c5) AND (r5.c5 <> r7.c5) AND (r5.c5 <> r8.c5) AND (r5.c5 <> r9.c5) AND (r5.c6 <> r6.c6) AND (r5.c6 <> r7.c6) AND
(r5.c6 <> r8.c6) AND (r5.c6 <> r9.c6) AND (r5.c7 <> r6.c7) AND (r5.c7 <> r7.c7) AND (r5.c7 <> r8.c7) AND (r5.c7 <> r9.c7) AND (r5.c8 <> r6.c8) AND (r5.c8 <> r7.c8) AND (r5.c8 <> r8.c8) AND (r5.c8 <> r9.c8) AND (r5.c9 <> r6.c9) AND (r5.c9 <> r7.c9) AND (r5.c9 <> r8.c9) AND (r5.c9 <> r9.c9) AND (r6.c1 <> r7.c1) AND (r6.c1 <> r8.c1) AND
(r6.c1 <> r9.c1) AND (r6.c2 <> r7.c2) AND (r6.c2 <> r8.c2) AND (r6.c2 <> r9.c2) AND (r6.c3 <> r7.c3) AND (r6.c3 <> r8.c3) AND (r6.c3 <> r9.c3) AND (r6.c4 <> r7.c4) AND (r6.c4 <> r8.c4) AND (r6.c4 <> r9.c4) AND (r6.c5 <> r7.c5) AND (r6.c5 <> r8.c5) AND (r6.c5 <> r9.c5) AND (r6.c6 <> r7.c6) AND (r6.c6 <> r8.c6) AND (r6.c6 <> r9.c6) AND
(r6.c7 <> r7.c7) AND (r6.c7 <> r8.c7) AND (r6.c7 <> r9.c7) AND (r6.c8 <> r7.c8) AND (r6.c8 <> r8.c8) AND (r6.c8 <> r9.c8) AND (r6.c9 <> r7.c9) AND (r6.c9 <> r8.c9) AND (r6.c9 <> r9.c9) AND (r7.c1 <> r8.c1) AND (r7.c1 <> r9.c1) AND (r7.c2 <> r8.c2) AND (r7.c2 <> r9.c2) AND (r7.c3 <> r8.c3) AND (r7.c3 <> r9.c3) AND (r7.c4 <> r8.c4) AND
(r7.c4 <> r9.c4) AND (r7.c5 <> r8.c5) AND (r7.c5 <> r9.c5) AND (r7.c6 <> r8.c6) AND (r7.c6 <> r9.c6) AND (r7.c7 <> r8.c7) AND (r7.c7 <> r9.c7) AND (r7.c8 <> r8.c8) AND (r7.c8 <> r9.c8) AND (r7.c9 <> r8.c9) AND (r7.c9 <> r9.c9) AND (r8.c1 <> r9.c1) AND (r8.c2 <> r9.c2) AND (r8.c3 <> r9.c3) AND (r8.c4 <> r9.c4) AND (r8.c5 <> r9.c5) AND
(r8.c6 <> r9.c6) AND (r8.c7 <> r9.c7) AND (r8.c8 <> r9.c8) AND (r8.c9 <> r9.c9) AND
-- Nombres uniques dans chaque maison de 3x3
(r1.c1 <> r2.c2) AND (r1.c1 <> r2.c3) AND (r1.c1 <> r3.c2) AND (r1.c1 <> r3.c3) AND (r1.c2 <> r2.c1) AND (r1.c2 <> r2.c3) AND (r1.c2 <> r3.c1) AND (r1.c2 <> r3.c3) AND (r1.c3 <> r2.c1) AND (r1.c3 <> r2.c2) AND (r1.c3 <> r3.c1) AND (r1.c3 <> r3.c2) AND (r1.c4 <> r2.c5) AND (r1.c4 <> r2.c6) AND (r1.c4 <> r3.c5) AND (r1.c4 <> r3.c6) AND
(r1.c5 <> r2.c4) AND (r1.c5 <> r2.c6) AND (r1.c5 <> r3.c4) AND (r1.c5 <> r3.c6) AND (r1.c6 <> r2.c4) AND (r1.c6 <> r2.c5) AND (r1.c6 <> r3.c4) AND (r1.c6 <> r3.c5) AND (r1.c7 <> r2.c8) AND (r1.c7 <> r2.c9) AND (r1.c7 <> r3.c8) AND (r1.c7 <> r3.c9) AND (r1.c8 <> r2.c7) AND (r1.c8 <> r2.c9) AND (r1.c8 <> r3.c7) AND (r1.c8 <> r3.c9) AND
(r1.c9 <> r2.c7) AND (r1.c9 <> r2.c8) AND (r1.c9 <> r3.c7) AND (r1.c9 <> r3.c8) AND (r2.c1 <> r3.c2) AND (r2.c1 <> r3.c3) AND (r2.c2 <> r3.c1) AND (r2.c2 <> r3.c3) AND (r2.c3 <> r3.c1) AND (r2.c3 <> r3.c2) AND (r2.c4 <> r3.c5) AND (r2.c4 <> r3.c6) AND (r2.c5 <> r3.c4) AND (r2.c5 <> r3.c6) AND (r2.c6 <> r3.c4) AND (r2.c6 <> r3.c5) AND
(r2.c7 <> r3.c8) AND (r2.c7 <> r3.c9) AND (r2.c8 <> r3.c7) AND (r2.c8 <> r3.c9) AND (r2.c9 <> r3.c7) AND (r2.c9 <> r3.c8) AND (r4.c1 <> r5.c2) AND (r4.c1 <> r5.c3) AND (r4.c1 <> r6.c2) AND (r4.c1 <> r6.c3) AND (r4.c2 <> r5.c1) AND (r4.c2 <> r5.c3) AND (r4.c2 <> r6.c1) AND (r4.c2 <> r6.c3) AND (r4.c3 <> r5.c1) AND (r4.c3 <> r5.c2) AND
(r4.c3 <> r6.c1) AND (r4.c3 <> r6.c2) AND (r4.c4 <> r5.c5) AND (r4.c4 <> r5.c6) AND (r4.c4 <> r6.c5) AND (r4.c4 <> r6.c6) AND (r4.c5 <> r5.c4) AND (r4.c5 <> r5.c6) AND (r4.c5 <> r6.c4) AND (r4.c5 <> r6.c6) AND (r4.c6 <> r5.c4) AND (r4.c6 <> r5.c5) AND (r4.c6 <> r6.c4) AND (r4.c6 <> r6.c5) AND (r4.c7 <> r5.c8) AND (r4.c7 <> r5.c9) AND
(r4.c7 <> r6.c8) AND (r4.c7 <> r6.c9) AND (r4.c8 <> r5.c7) AND (r4.c8 <> r5.c9) AND (r4.c8 <> r6.c7) AND (r4.c8 <> r6.c9) AND (r4.c9 <> r5.c7) AND (r4.c9 <> r5.c8) AND (r4.c9 <> r6.c7) AND (r4.c9 <> r6.c8) AND (r5.c1 <> r6.c2) AND (r5.c1 <> r6.c3) AND (r5.c2 <> r6.c1) AND (r5.c2 <> r6.c3) AND (r5.c3 <> r6.c1) AND (r5.c3 <> r6.c2) AND
(r5.c4 <> r6.c5) AND (r5.c4 <> r6.c6) AND (r5.c5 <> r6.c4) AND (r5.c5 <> r6.c6) AND (r5.c6 <> r6.c4) AND (r5.c6 <> r6.c5) AND (r5.c7 <> r6.c8) AND (r5.c7 <> r6.c9) AND (r5.c8 <> r6.c7) AND (r5.c8 <> r6.c9) AND (r5.c9 <> r6.c7) AND (r5.c9 <> r6.c8) AND (r7.c1 <> r8.c2) AND (r7.c1 <> r8.c3) AND (r7.c1 <> r9.c2) AND (r7.c1 <> r9.c3) AND
(r7.c2 <> r8.c1) AND (r7.c2 <> r8.c3) AND (r7.c2 <> r9.c1) AND (r7.c2 <> r9.c3) AND (r7.c3 <> r8.c1) AND (r7.c3 <> r8.c2) AND (r7.c3 <> r9.c1) AND (r7.c3 <> r9.c2) AND (r7.c4 <> r8.c5) AND (r7.c4 <> r8.c6) AND (r7.c4 <> r9.c5) AND (r7.c4 <> r9.c6) AND (r7.c5 <> r8.c4) AND (r7.c5 <> r8.c6) AND (r7.c5 <> r9.c4) AND (r7.c5 <> r9.c6) AND
(r7.c6 <> r8.c4) AND (r7.c6 <> r8.c5) AND (r7.c6 <> r9.c4) AND (r7.c6 <> r9.c5) AND (r7.c7 <> r8.c8) AND (r7.c7 <> r8.c9) AND (r7.c7 <> r9.c8) AND (r7.c7 <> r9.c9) AND (r7.c8 <> r8.c7) AND (r7.c8 <> r8.c9) AND (r7.c8 <> r9.c7) AND (r7.c8 <> r9.c9) AND (r7.c9 <> r8.c7) AND (r7.c9 <> r8.c8) AND (r7.c9 <> r9.c7) AND (r7.c9 <> r9.c8) AND
(r8.c1 <> r9.c2) AND (r8.c1 <> r9.c3) AND (r8.c2 <> r9.c1) AND (r8.c2 <> r9.c3) AND (r8.c3 <> r9.c1) AND (r8.c3 <> r9.c2) AND (r8.c4 <> r9.c5) AND (r8.c4 <> r9.c6) AND (r8.c5 <> r9.c4) AND (r8.c5 <> r9.c6) AND (r8.c6 <> r9.c4) AND (r8.c6 <> r9.c5) AND (r8.c7 <> r9.c8) AND (r8.c7 <> r9.c9) AND (r8.c8 <> r9.c7) AND (r8.c8 <> r9.c9) AND
(r8.c9 <> r9.c7) AND (r8.c9 <> r9.c8);

En second lieu, la vue sur les colonnes.

USE sudoku;

DROP VIEW IF EXISTS sudoku_memory_columns_view;
CREATE VIEW sudoku_memory_columns_view AS
SELECT
col1.c1 as r1c1, col1.c2 as r2c1, col1.c3 as r3c1, col1.c4 as r4c1, col1.c5 as r5c1,col1.c6 as r6c1, col1.c7 as r7c1, col1.c8 as r8c1, col1.c9 as r9c1, col2.c1 as r1c2,
col2.c2 as r2c2, col2.c3 as r3c2, col2.c4 as r4c2, col2.c5 as r5c2, col2.c6 as r6c2,col2.c7 as r7c2, col2.c8 as r8c2, col2.c9 as r9c2, col3.c1 as r1c3, col3.c2 as r2c3,
col3.c3 as r3c3, col3.c4 as r4c3, col3.c5 as r5c3, col3.c6 as r6c3, col3.c7 as r7c3,col3.c8 as r8c3, col3.c9 as r9c3, col4.c1 as r1c4, col4.c2 as r2c4, col4.c3 as r3c4,
col4.c4 as r4c4, col4.c5 as r5c4, col4.c6 as r6c4, col4.c7 as r7c4, col4.c8 as r8c4,col4.c9 as r9c4, col5.c1 as r1c5, col5.c2 as r2c5, col5.c3 as r3c5, col5.c4 as r4c5,
col5.c5 as r5c5, col5.c6 as r6c5, col5.c7 as r7c5, col5.c8 as r8c5, col5.c9 as r9c5,col6.c1 as r1c6, col6.c2 as r2c6, col6.c3 as r3c6, col6.c4 as r4c6, col6.c5 as r5c6,
col6.c6 as r6c6, col6.c7 as r7c6, col6.c8 as r8c6, col6.c9 as r9c6, col7.c1 as r1c7,col7.c2 as r2c7, col7.c3 as r3c7, col7.c4 as r4c7, col7.c5 as r5c7, col7.c6 as r6c7,
col7.c7 as r7c7, col7.c8 as r8c7, col7.c9 as r9c7, col8.c1 as r1c8, col8.c2 as r2c8,col8.c3 as r3c8, col8.c4 as r4c8, col8.c5 as r5c8, col8.c6 as r6c8, col8.c7 as r7c8,
col8.c8 as r8c8, col8.c9 as r9c8, col9.c1 as r1c9, col9.c2 as r2c9, col9.c3 as r3c9,col9.c4 as r4c9, col9.c5 as r5c9, col9.c6 as r6c9, col9.c7 as r7c9, col9.c8 as r8c9,
col9.c9 as r9c9
FROM
positions_memory col1, positions_memory col2, positions_memory col3, positions_memory col4,
positions_memory col5, positions_memory col6, positions_memory col7, positions_memory col8, positions_memory col9
WHERE
-- Nombres uniques dans chaque rangee
(col1.c1 <> col2.c1) AND (col1.c1 <> col3.c1) AND (col1.c1 <> col4.c1) AND (col1.c1 <> col5.c1) AND (col1.c1 <> col6.c1) AND (col1.c1 <> col7.c1) AND (col1.c1 <> col8.c1) AND (col1.c1 <> col9.c1) AND (col1.c2 <> col2.c2) AND (col1.c2 <> col3.c2) AND (col1.c2 <> col4.c2) AND (col1.c2 <> col5.c2) AND (col1.c2 <> col6.c2) AND (col1.c2 <> col7.c2) AND (col1.c2 <> col8.c2) AND (col1.c2 <> col9.c2) AND (col1.c3 <> col2.c3) AND (col1.c3 <> col3.c3) AND (col1.c3 <> col4.c3) AND (col1.c3 <> col5.c3) AND (col1.c3 <> col6.c3) AND (col1.c3 <> col7.c3) AND (col1.c3 <> col8.c3) AND (col1.c3 <> col9.c3) AND (col1.c4 <> col2.c4) AND (col1.c4 <> col3.c4) AND (col1.c4 <> col4.c4) AND (col1.c4 <> col5.c4) AND (col1.c4 <> col6.c4) AND (col1.c4 <> col7.c4) AND (col1.c4 <> col8.c4) AND (col1.c4 <> col9.c4) AND
(col1.c5 <> col2.c5) AND (col1.c5 <> col3.c5) AND (col1.c5 <> col4.c5) AND (col1.c5 <> col5.c5) AND (col1.c5 <> col6.c5) AND (col1.c5 <> col7.c5) AND (col1.c5 <> col8.c5) AND (col1.c5 <> col9.c5) AND (col1.c6 <> col2.c6) AND (col1.c6 <> col3.c6) AND (col1.c6 <> col4.c6) AND (col1.c6 <> col5.c6) AND (col1.c6 <> col6.c6) AND (col1.c6 <> col7.c6) AND (col1.c6 <> col8.c6) AND (col1.c6 <> col9.c6) AND (col1.c7 <> col2.c7) AND (col1.c7 <> col3.c7) AND (col1.c7 <> col4.c7) AND (col1.c7 <> col5.c7) AND (col1.c7 <> col6.c7) AND (col1.c7 <> col7.c7) AND (col1.c7 <> col8.c7) AND (col1.c7 <> col9.c7) AND (col1.c8 <> col2.c8) AND (col1.c8 <> col3.c8) AND (col1.c8 <> col4.c8) AND (col1.c8 <> col5.c8) AND (col1.c8 <> col6.c8) AND (col1.c8 <> col7.c8) AND (col1.c8 <> col8.c8) AND (col1.c8 <> col9.c8) AND
(col1.c9 <> col2.c9) AND (col1.c9 <> col3.c9) AND (col1.c9 <> col4.c9) AND (col1.c9 <> col5.c9) AND (col1.c9 <> col6.c9) AND (col1.c9 <> col7.c9) AND (col1.c9 <> col8.c9) AND (col1.c9 <> col9.c9) AND (col2.c1 <> col3.c1) AND (col2.c1 <> col4.c1) AND (col2.c1 <> col5.c1) AND (col2.c1 <> col6.c1) AND (col2.c1 <> col7.c1) AND (col2.c1 <> col8.c1) AND (col2.c1 <> col9.c1) AND (col2.c2 <> col3.c2) AND (col2.c2 <> col4.c2) AND (col2.c2 <> col5.c2) AND (col2.c2 <> col6.c2) AND (col2.c2 <> col7.c2) AND (col2.c2 <> col8.c2) AND (col2.c2 <> col9.c2) AND (col2.c3 <> col3.c3) AND (col2.c3 <> col4.c3) AND (col2.c3 <> col5.c3) AND (col2.c3 <> col6.c3) AND (col2.c3 <> col7.c3) AND (col2.c3 <> col8.c3) AND (col2.c3 <> col9.c3) AND (col2.c4 <> col3.c4) AND (col2.c4 <> col4.c4) AND (col2.c4 <> col5.c4) AND
(col2.c4 <> col6.c4) AND (col2.c4 <> col7.c4) AND (col2.c4 <> col8.c4) AND (col2.c4 <> col9.c4) AND (col2.c5 <> col3.c5) AND (col2.c5 <> col4.c5) AND (col2.c5 <> col5.c5) AND (col2.c5 <> col6.c5) AND (col2.c5 <> col7.c5) AND (col2.c5 <> col8.c5) AND (col2.c5 <> col9.c5) AND (col2.c6 <> col3.c6) AND (col2.c6 <> col4.c6) AND (col2.c6 <> col5.c6) AND (col2.c6 <> col6.c6) AND (col2.c6 <> col7.c6) AND (col2.c6 <> col8.c6) AND (col2.c6 <> col9.c6) AND (col2.c7 <> col3.c7) AND (col2.c7 <> col4.c7) AND (col2.c7 <> col5.c7) AND (col2.c7 <> col6.c7) AND (col2.c7 <> col7.c7) AND (col2.c7 <> col8.c7) AND (col2.c7 <> col9.c7) AND (col2.c8 <> col3.c8) AND (col2.c8 <> col4.c8) AND (col2.c8 <> col5.c8) AND (col2.c8 <> col6.c8) AND (col2.c8 <> col7.c8) AND (col2.c8 <> col8.c8) AND (col2.c8 <> col9.c8) AND
(col2.c9 <> col3.c9) AND (col2.c9 <> col4.c9) AND (col2.c9 <> col5.c9) AND (col2.c9 <> col6.c9) AND (col2.c9 <> col7.c9) AND (col2.c9 <> col8.c9) AND (col2.c9 <> col9.c9) AND (col3.c1 <> col4.c1) AND (col3.c1 <> col5.c1) AND (col3.c1 <> col6.c1) AND (col3.c1 <> col7.c1) AND (col3.c1 <> col8.c1) AND (col3.c1 <> col9.c1) AND (col3.c2 <> col4.c2) AND (col3.c2 <> col5.c2) AND (col3.c2 <> col6.c2) AND (col3.c2 <> col7.c2) AND (col3.c2 <> col8.c2) AND (col3.c2 <> col9.c2) AND (col3.c3 <> col4.c3) AND (col3.c3 <> col5.c3) AND (col3.c3 <> col6.c3) AND (col3.c3 <> col7.c3) AND (col3.c3 <> col8.c3) AND (col3.c3 <> col9.c3) AND (col3.c4 <> col4.c4) AND (col3.c4 <> col5.c4) AND (col3.c4 <> col6.c4) AND (col3.c4 <> col7.c4) AND (col3.c4 <> col8.c4) AND (col3.c4 <> col9.c4) AND (col3.c5 <> col4.c5) AND
(col3.c5 <> col5.c5) AND (col3.c5 <> col6.c5) AND (col3.c5 <> col7.c5) AND (col3.c5 <> col8.c5) AND (col3.c5 <> col9.c5) AND (col3.c6 <> col4.c6) AND (col3.c6 <> col5.c6) AND (col3.c6 <> col6.c6) AND (col3.c6 <> col7.c6) AND (col3.c6 <> col8.c6) AND (col3.c6 <> col9.c6) AND (col3.c7 <> col4.c7) AND (col3.c7 <> col5.c7) AND (col3.c7 <> col6.c7) AND (col3.c7 <> col7.c7) AND (col3.c7 <> col8.c7) AND (col3.c7 <> col9.c7) AND (col3.c8 <> col4.c8) AND (col3.c8 <> col5.c8) AND (col3.c8 <> col6.c8) AND (col3.c8 <> col7.c8) AND (col3.c8 <> col8.c8) AND (col3.c8 <> col9.c8) AND (col3.c9 <> col4.c9) AND (col3.c9 <> col5.c9) AND (col3.c9 <> col6.c9) AND (col3.c9 <> col7.c9) AND (col3.c9 <> col8.c9) AND (col3.c9 <> col9.c9) AND (col4.c1 <> col5.c1) AND (col4.c1 <> col6.c1) AND (col4.c1 <> col7.c1) AND
(col4.c1 <> col8.c1) AND (col4.c1 <> col9.c1) AND (col4.c2 <> col5.c2) AND (col4.c2 <> col6.c2) AND (col4.c2 <> col7.c2) AND (col4.c2 <> col8.c2) AND (col4.c2 <> col9.c2) AND (col4.c3 <> col5.c3) AND (col4.c3 <> col6.c3) AND (col4.c3 <> col7.c3) AND (col4.c3 <> col8.c3) AND (col4.c3 <> col9.c3) AND (col4.c4 <> col5.c4) AND (col4.c4 <> col6.c4) AND (col4.c4 <> col7.c4) AND (col4.c4 <> col8.c4) AND (col4.c4 <> col9.c4) AND (col4.c5 <> col5.c5) AND (col4.c5 <> col6.c5) AND (col4.c5 <> col7.c5) AND (col4.c5 <> col8.c5) AND (col4.c5 <> col9.c5) AND (col4.c6 <> col5.c6) AND (col4.c6 <> col6.c6) AND (col4.c6 <> col7.c6) AND (col4.c6 <> col8.c6) AND (col4.c6 <> col9.c6) AND (col4.c7 <> col5.c7) AND (col4.c7 <> col6.c7) AND (col4.c7 <> col7.c7) AND (col4.c7 <> col8.c7) AND (col4.c7 <> col9.c7) AND
(col4.c8 <> col5.c8) AND (col4.c8 <> col6.c8) AND (col4.c8 <> col7.c8) AND (col4.c8 <> col8.c8) AND (col4.c8 <> col9.c8) AND (col4.c9 <> col5.c9) AND (col4.c9 <> col6.c9) AND (col4.c9 <> col7.c9) AND (col4.c9 <> col8.c9) AND (col4.c9 <> col9.c9) AND (col5.c1 <> col6.c1) AND (col5.c1 <> col7.c1) AND (col5.c1 <> col8.c1) AND (col5.c1 <> col9.c1) AND (col5.c2 <> col6.c2) AND (col5.c2 <> col7.c2) AND (col5.c2 <> col8.c2) AND (col5.c2 <> col9.c2) AND (col5.c3 <> col6.c3) AND (col5.c3 <> col7.c3) AND (col5.c3 <> col8.c3) AND (col5.c3 <> col9.c3) AND (col5.c4 <> col6.c4) AND (col5.c4 <> col7.c4) AND (col5.c4 <> col8.c4) AND (col5.c4 <> col9.c4) AND (col5.c5 <> col6.c5) AND (col5.c5 <> col7.c5) AND (col5.c5 <> col8.c5) AND (col5.c5 <> col9.c5) AND (col5.c6 <> col6.c6) AND (col5.c6 <> col7.c6) AND
(col5.c6 <> col8.c6) AND (col5.c6 <> col9.c6) AND (col5.c7 <> col6.c7) AND (col5.c7 <> col7.c7) AND (col5.c7 <> col8.c7) AND (col5.c7 <> col9.c7) AND (col5.c8 <> col6.c8) AND (col5.c8 <> col7.c8) AND (col5.c8 <> col8.c8) AND (col5.c8 <> col9.c8) AND (col5.c9 <> col6.c9) AND (col5.c9 <> col7.c9) AND (col5.c9 <> col8.c9) AND (col5.c9 <> col9.c9) AND (col6.c1 <> col7.c1) AND (col6.c1 <> col8.c1) AND (col6.c1 <> col9.c1) AND (col6.c2 <> col7.c2) AND (col6.c2 <> col8.c2) AND (col6.c2 <> col9.c2) AND (col6.c3 <> col7.c3) AND (col6.c3 <> col8.c3) AND (col6.c3 <> col9.c3) AND (col6.c4 <> col7.c4) AND (col6.c4 <> col8.c4) AND (col6.c4 <> col9.c4) AND (col6.c5 <> col7.c5) AND (col6.c5 <> col8.c5) AND (col6.c5 <> col9.c5) AND (col6.c6 <> col7.c6) AND (col6.c6 <> col8.c6) AND (col6.c6 <> col9.c6) AND
(col6.c7 <> col7.c7) AND (col6.c7 <> col8.c7) AND (col6.c7 <> col9.c7) AND (col6.c8 <> col7.c8) AND (col6.c8 <> col8.c8) AND (col6.c8 <> col9.c8) AND (col6.c9 <> col7.c9) AND (col6.c9 <> col8.c9) AND (col6.c9 <> col9.c9) AND (col7.c1 <> col8.c1) AND (col7.c1 <> col9.c1) AND (col7.c2 <> col8.c2) AND (col7.c2 <> col9.c2) AND (col7.c3 <> col8.c3) AND (col7.c3 <> col9.c3) AND (col7.c4 <> col8.c4) AND (col7.c4 <> col9.c4) AND (col7.c5 <> col8.c5) AND (col7.c5 <> col9.c5) AND (col7.c6 <> col8.c6) AND (col7.c6 <> col9.c6) AND (col7.c7 <> col8.c7) AND (col7.c7 <> col9.c7) AND (col7.c8 <> col8.c8) AND (col7.c8 <> col9.c8) AND (col7.c9 <> col8.c9) AND (col7.c9 <> col9.c9) AND (col8.c1 <> col9.c1) AND (col8.c2 <> col9.c2) AND (col8.c3 <> col9.c3) AND (col8.c4 <> col9.c4) AND (col8.c5 <> col9.c5) AND
(col8.c6 <> col9.c6) AND (col8.c7 <> col9.c7) AND (col8.c8 <> col9.c8) AND (col8.c9 <> col9.c9) AND
-- Nombres uniques dans chaque maison de 3x3
(col1.c1 <> col1.c2) AND (col1.c1 <> col1.c3) AND (col1.c1 <> col2.c2) AND (col1.c1 <> col2.c3) AND (col1.c1 <> col3.c2) AND (col1.c1 <> col3.c3) AND (col1.c2 <> col1.c3) AND (col1.c2 <> col2.c1) AND (col1.c2 <> col2.c3) AND (col1.c2 <> col3.c1) AND (col1.c2 <> col3.c3) AND (col1.c3 <> col2.c1) AND (col1.c3 <> col2.c2) AND (col1.c3 <> col3.c1) AND (col1.c3 <> col3.c2) AND (col1.c4 <> col1.c5) AND (col1.c4 <> col1.c6) AND (col1.c4 <> col2.c5) AND (col1.c4 <> col2.c6) AND (col1.c4 <> col3.c5) AND (col1.c4 <> col3.c6) AND (col1.c5 <> col1.c6) AND (col1.c5 <> col2.c4) AND (col1.c5 <> col2.c6) AND (col1.c5 <> col3.c4) AND (col1.c5 <> col3.c6) AND (col1.c6 <> col2.c4) AND (col1.c6 <> col2.c5) AND (col1.c6 <> col3.c4) AND (col1.c6 <> col3.c5) AND (col1.c7 <> col1.c8) AND (col1.c7 <> col1.c9) AND
(col1.c7 <> col2.c8) AND (col1.c7 <> col2.c9) AND (col1.c7 <> col3.c8) AND (col1.c7 <> col3.c9) AND (col1.c8 <> col1.c9) AND (col1.c8 <> col2.c7) AND (col1.c8 <> col2.c9) AND (col1.c8 <> col3.c7) AND (col1.c8 <> col3.c9) AND (col1.c9 <> col2.c7) AND (col1.c9 <> col2.c8) AND (col1.c9 <> col3.c7) AND (col1.c9 <> col3.c8) AND (col2.c1 <> col2.c2) AND (col2.c1 <> col2.c3) AND (col2.c1 <> col3.c2) AND (col2.c1 <> col3.c3) AND (col2.c2 <> col2.c3) AND (col2.c2 <> col3.c1) AND (col2.c2 <> col3.c3) AND (col2.c3 <> col3.c1) AND (col2.c3 <> col3.c2) AND (col2.c4 <> col2.c5) AND (col2.c4 <> col2.c6) AND (col2.c4 <> col3.c5) AND (col2.c4 <> col3.c6) AND (col2.c5 <> col2.c6) AND (col2.c5 <> col3.c4) AND (col2.c5 <> col3.c6) AND (col2.c6 <> col3.c4) AND (col2.c6 <> col3.c5) AND (col2.c7 <> col2.c8) AND
(col2.c7 <> col2.c9) AND (col2.c7 <> col3.c8) AND (col2.c7 <> col3.c9) AND (col2.c8 <> col2.c9) AND (col2.c8 <> col3.c7) AND (col2.c8 <> col3.c9) AND (col2.c9 <> col3.c7) AND (col2.c9 <> col3.c8) AND (col3.c1 <> col3.c2) AND (col3.c1 <> col3.c3) AND (col3.c2 <> col3.c3) AND (col3.c4 <> col3.c5) AND (col3.c4 <> col3.c6) AND (col3.c5 <> col3.c6) AND (col3.c7 <> col3.c8) AND (col3.c7 <> col3.c9) AND (col3.c8 <> col3.c9) AND (col4.c1 <> col4.c2) AND (col4.c1 <> col4.c3) AND (col4.c1 <> col5.c2) AND (col4.c1 <> col5.c3) AND (col4.c1 <> col6.c2) AND (col4.c1 <> col6.c3) AND (col4.c2 <> col4.c3) AND (col4.c2 <> col5.c1) AND (col4.c2 <> col5.c3) AND (col4.c2 <> col6.c1) AND (col4.c2 <> col6.c3) AND (col4.c3 <> col5.c1) AND (col4.c3 <> col5.c2) AND (col4.c3 <> col6.c1) AND (col4.c3 <> col6.c2) AND
(col4.c4 <> col4.c5) AND (col4.c4 <> col4.c6) AND (col4.c4 <> col5.c5) AND (col4.c4 <> col5.c6) AND (col4.c4 <> col6.c5) AND (col4.c4 <> col6.c6) AND (col4.c5 <> col4.c6) AND (col4.c5 <> col5.c4) AND (col4.c5 <> col5.c6) AND (col4.c5 <> col6.c4) AND (col4.c5 <> col6.c6) AND (col4.c6 <> col5.c4) AND (col4.c6 <> col5.c5) AND (col4.c6 <> col6.c4) AND (col4.c6 <> col6.c5) AND (col4.c7 <> col4.c8) AND (col4.c7 <> col4.c9) AND (col4.c7 <> col5.c8) AND (col4.c7 <> col5.c9) AND (col4.c7 <> col6.c8) AND (col4.c7 <> col6.c9) AND (col4.c8 <> col4.c9) AND (col4.c8 <> col5.c7) AND (col4.c8 <> col5.c9) AND (col4.c8 <> col6.c7) AND (col4.c8 <> col6.c9) AND (col4.c9 <> col5.c7) AND (col4.c9 <> col5.c8) AND (col4.c9 <> col6.c7) AND (col4.c9 <> col6.c8) AND (col5.c1 <> col5.c2) AND (col5.c1 <> col5.c3) AND
(col5.c1 <> col6.c2) AND (col5.c1 <> col6.c3) AND (col5.c2 <> col5.c3) AND (col5.c2 <> col6.c1) AND (col5.c2 <> col6.c3) AND (col5.c3 <> col6.c1) AND (col5.c3 <> col6.c2) AND (col5.c4 <> col5.c5) AND (col5.c4 <> col5.c6) AND (col5.c4 <> col6.c5) AND (col5.c4 <> col6.c6) AND (col5.c5 <> col5.c6) AND (col5.c5 <> col6.c4) AND (col5.c5 <> col6.c6) AND (col5.c6 <> col6.c4) AND (col5.c6 <> col6.c5) AND (col5.c7 <> col5.c8) AND (col5.c7 <> col5.c9) AND (col5.c7 <> col6.c8) AND (col5.c7 <> col6.c9) AND (col5.c8 <> col5.c9) AND (col5.c8 <> col6.c7) AND (col5.c8 <> col6.c9) AND (col5.c9 <> col6.c7) AND (col5.c9 <> col6.c8) AND (col6.c1 <> col6.c2) AND (col6.c1 <> col6.c3) AND (col6.c2 <> col6.c3) AND (col6.c4 <> col6.c5) AND (col6.c4 <> col6.c6) AND (col6.c5 <> col6.c6) AND (col6.c7 <> col6.c8) AND
(col6.c7 <> col6.c9) AND (col6.c8 <> col6.c9) AND (col7.c1 <> col7.c2) AND (col7.c1 <> col7.c3) AND (col7.c1 <> col8.c2) AND (col7.c1 <> col8.c3) AND (col7.c1 <> col9.c2) AND (col7.c1 <> col9.c3) AND (col7.c2 <> col7.c3) AND (col7.c2 <> col8.c1) AND (col7.c2 <> col8.c3) AND (col7.c2 <> col9.c1) AND (col7.c2 <> col9.c3) AND (col7.c3 <> col8.c1) AND (col7.c3 <> col8.c2) AND (col7.c3 <> col9.c1) AND (col7.c3 <> col9.c2) AND (col7.c4 <> col7.c5) AND (col7.c4 <> col7.c6) AND (col7.c4 <> col8.c5) AND (col7.c4 <> col8.c6) AND (col7.c4 <> col9.c5) AND (col7.c4 <> col9.c6) AND (col7.c5 <> col7.c6) AND (col7.c5 <> col8.c4) AND (col7.c5 <> col8.c6) AND (col7.c5 <> col9.c4) AND (col7.c5 <> col9.c6) AND (col7.c6 <> col8.c4) AND (col7.c6 <> col8.c5) AND (col7.c6 <> col9.c4) AND (col7.c6 <> col9.c5) AND
(col7.c7 <> col7.c8) AND (col7.c7 <> col7.c9) AND (col7.c7 <> col8.c8) AND (col7.c7 <> col8.c9) AND (col7.c7 <> col9.c8) AND (col7.c7 <> col9.c9) AND (col7.c8 <> col7.c9) AND (col7.c8 <> col8.c7) AND (col7.c8 <> col8.c9) AND (col7.c8 <> col9.c7) AND (col7.c8 <> col9.c9) AND (col7.c9 <> col8.c7) AND (col7.c9 <> col8.c8) AND (col7.c9 <> col9.c7) AND (col7.c9 <> col9.c8) AND (col8.c1 <> col8.c2) AND (col8.c1 <> col8.c3) AND (col8.c1 <> col9.c2) AND (col8.c1 <> col9.c3) AND (col8.c2 <> col8.c3) AND (col8.c2 <> col9.c1) AND (col8.c2 <> col9.c3) AND (col8.c3 <> col9.c1) AND (col8.c3 <> col9.c2) AND (col8.c4 <> col8.c5) AND (col8.c4 <> col8.c6) AND (col8.c4 <> col9.c5) AND (col8.c4 <> col9.c6) AND (col8.c5 <> col8.c6) AND (col8.c5 <> col9.c4) AND (col8.c5 <> col9.c6) AND (col8.c6 <> col9.c4) AND
(col8.c6 <> col9.c5) AND (col8.c7 <> col8.c8) AND (col8.c7 <> col8.c9) AND (col8.c7 <> col9.c8) AND (col8.c7 <> col9.c9) AND (col8.c8 <> col8.c9) AND (col8.c8 <> col9.c7) AND (col8.c8 <> col9.c9) AND (col8.c9 <> col9.c7) AND (col8.c9 <> col9.c8) AND (col9.c1 <> col9.c2) AND (col9.c1 <> col9.c3) AND (col9.c2 <> col9.c3) AND (col9.c4 <> col9.c5) AND (col9.c4 <> col9.c6) AND (col9.c5 <> col9.c6) AND (col9.c7 <> col9.c8) AND (col9.c7 <> col9.c9) AND (col9.c8 <> col9.c9);

Finalement, la vue combinée.

USE sudoku;

DROP VIEW IF EXISTS sudoku_memory_combined_view;
CREATE VIEW sudoku_memory_combined_view AS
SELECT t1.*
FROM sudoku_memory_rows_view t1
INNER JOIN sudoku_memory_columns_view t2
ON

-- Jointures entre représentation-colonnes et représentation-rangées
(t1.r1c1 = t2.r1c1) AND (t1.r1c2 = t2.r1c2) AND (t1.r1c3 = t2.r1c3) AND (t1.r1c4 = t2.r1c4) AND
(t1.r1c5 = t2.r1c5) AND (t1.r1c6 = t2.r1c6) AND (t1.r1c7 = t2.r1c7) AND (t1.r1c8 = t2.r1c8) AND
(t1.r1c9 = t2.r1c9) AND (t1.r2c1 = t2.r2c1) AND (t1.r2c2 = t2.r2c2) AND (t1.r2c3 = t2.r2c3) AND
(t1.r2c4 = t2.r2c4) AND (t1.r2c5 = t2.r2c5) AND (t1.r2c6 = t2.r2c6) AND (t1.r2c7 = t2.r2c7) AND
(t1.r2c8 = t2.r2c8) AND (t1.r2c9 = t2.r2c9) AND (t1.r3c1 = t2.r3c1) AND (t1.r3c2 = t2.r3c2) AND
(t1.r3c3 = t2.r3c3) AND (t1.r3c4 = t2.r3c4) AND (t1.r3c5 = t2.r3c5) AND (t1.r3c6 = t2.r3c6) AND
(t1.r3c7 = t2.r3c7) AND (t1.r3c8 = t2.r3c8) AND (t1.r3c9 = t2.r3c9) AND (t1.r4c1 = t2.r4c1) AND
(t1.r4c2 = t2.r4c2) AND (t1.r4c3 = t2.r4c3) AND (t1.r4c4 = t2.r4c4) AND (t1.r4c5 = t2.r4c5) AND
(t1.r4c6 = t2.r4c6) AND (t1.r4c7 = t2.r4c7) AND (t1.r4c8 = t2.r4c8) AND (t1.r4c9 = t2.r4c9) AND
(t1.r5c1 = t2.r5c1) AND (t1.r5c2 = t2.r5c2) AND (t1.r5c3 = t2.r5c3) AND (t1.r5c4 = t2.r5c4) AND
(t1.r5c5 = t2.r5c5) AND (t1.r5c6 = t2.r5c6) AND (t1.r5c7 = t2.r5c7) AND (t1.r5c8 = t2.r5c8) AND
(t1.r5c9 = t2.r5c9) AND (t1.r6c1 = t2.r6c1) AND (t1.r6c2 = t2.r6c2) AND (t1.r6c3 = t2.r6c3) AND
(t1.r6c4 = t2.r6c4) AND (t1.r6c5 = t2.r6c5) AND (t1.r6c6 = t2.r6c6) AND (t1.r6c7 = t2.r6c7) AND
(t1.r6c8 = t2.r6c8) AND (t1.r6c9 = t2.r6c9) AND (t1.r7c1 = t2.r7c1) AND (t1.r7c2 = t2.r7c2) AND
(t1.r7c3 = t2.r7c3) AND (t1.r7c4 = t2.r7c4) AND (t1.r7c5 = t2.r7c5) AND (t1.r7c6 = t2.r7c6) AND
(t1.r7c7 = t2.r7c7) AND (t1.r7c8 = t2.r7c8) AND (t1.r7c9 = t2.r7c9) AND (t1.r8c1 = t2.r8c1) AND
(t1.r8c2 = t2.r8c2) AND (t1.r8c3 = t2.r8c3) AND (t1.r8c4 = t2.r8c4) AND (t1.r8c5 = t2.r8c5) AND
(t1.r8c6 = t2.r8c6) AND (t1.r8c7 = t2.r8c7) AND (t1.r8c8 = t2.r8c8) AND (t1.r8c9 = t2.r8c9) AND
(t1.r9c1 = t2.r9c1) AND (t1.r9c2 = t2.r9c2) AND (t1.r9c3 = t2.r9c3) AND (t1.r9c4 = t2.r9c4) AND
(t1.r9c5 = t2.r9c5) AND (t1.r9c6 = t2.r9c6) AND (t1.r9c7 = t2.r9c7) AND (t1.r9c8 = t2.r9c8) AND
(t1.r9c9 = t2.r9c9);

Réessayons l’exemple du début de cet article pour comparer :


mysql> SELECT *
 -> FROM sudoku_memory_combined_view
 -> WHERE
 -> (r2c2 = 3) AND (r2c3 = 4) AND (r2c4 = 8) AND (r2c5 = 2) AND
 -> (r2c6 = 5) AND (r2c7 = 6) AND (r2c8 = 9) AND (r3c2 = 5) AND
 -> (r3c3 = 9) AND (r3c4 = 3) AND (r3c5 = 6) AND (r3c6 = 4) AND
 -> (r3c7 = 1) AND (r3c8 = 8) AND (r4c2 = 9) AND (r4c3 = 7) AND
 -> (r4c4 = 1) AND (r4c5 = 8) AND (r4c6 = 2) AND (r4c7 = 5) AND
 -> (r4c8 = 6) AND (r6c2 = 8) AND (r6c3 = 1) AND (r6c4 = 4) AND
 -> (r6c5 = 7) AND (r6c6 = 6) AND (r6c7 = 2) AND (r6c8 = 3) AND
 -> (r7c2 = 2) AND (r7c3 = 5) AND (r7c4 = 6) AND (r7c5 = 4) AND
 -> (r7c6 = 1) AND (r7c7 = 9) AND (r7c8 = 7) AND (r8c2 = 7) AND
 -> (r8c3 = 6) AND (r8c4 = 5) AND (r8c5 = 3) AND (r8c6 = 8) AND
 -> (r8c7 = 4) AND (r8c8 = 2);
+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| r1c1 | r1c2 | r1c3 | r1c4 | r1c5 | r1c6 | r1c7 | r1c8 | r1c9 | r2c1 | r2c2 | r2c3 | r2c4 | r2c5 | r2c6 | r2c7 | r2c8 | r2c9 | r3c1 | r3c2 | r3c3 | r3c4 | r3c5 | r3c6 | r3c7 | r3c8 | r3c9 | r4c1 | r4c2 | r4c3 | r4c4 | r4c5 | r4c6 | r4c7 | r4c8 | r4c9 | r5c1 | r5c2 | r5c3 | r5c4 | r5c5 | r5c6 | r5c7 | r5c8 | r5c9 | r6c1 | r6c2 | r6c3 | r6c4 | r6c5 | r6c6 | r6c7 | r6c8 | r6c9 | r7c1 | r7c2 | r7c3 | r7c4 | r7c5 | r7c6 | r7c7 | r7c8 | r7c9 | r8c1 | r8c2 | r8c3 | r8c4 | r8c5 | r8c6 | r8c7 | r8c8 | r8c9 | r9c1 | r9c2 | r9c3 | r9c4 | r9c5 | r9c6 | r9c7 | r9c8 | r9c9 |
+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
|   2  |   6  |   8  |   7  |   1  |   9  |   3  |   4  |   5  |   1  |   3  |   4  |   8  |   2  |   5  |   6  |   9  |   7  |   7  |   5  |   9  |   3  |   6  |   4  |   1  |   8  |   2  |   3  |   9  |   7  |   1  |   8  |   2  |   5  |   6  |   4  |   6  |   4  |   2  |   9  |   5  |   3  |   7  |   1  |   8  |   5  |   8  |   1  |   4  |   7  |   6  |   2  |   3  |   9  |   8  |   2  |   5  |   6  |   4  |   1  |   9  |   7  |   3  |   9  |   7  |   6  |   5  |   3  |   8  |   4  |   2  |   1  |   4  |   1  |   3  |   2  |   9  |   7  |   8  |   5  |   6  |
+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
1 row in set (0.55 sec)

Wow! Nous sommes passés de 1.5 à 0.55 seconde! Maintenant, qu’en est-il de notre grille à 17 révélés ?

mysql> SELECT *
-> FROM sudoku_memory_combined_view
-> WHERE
-> (r1c8 = 1) AND
-> (r2c1 = 4) AND
-> (r3c2 = 2) AND
-> (r4c5 = 5) AND
-> (r4c7 = 4) AND
-> (r4c9 = 7) AND
-> (r5c3 = 8) AND
-> (r5c7 = 3) AND
-> (r6c3 = 1) AND
-> (r6c5 = 9) AND
-> (r7c1 = 3) AND
-> (r7c4 = 4) AND
-> (r7c7 = 2) AND
-> (r8c2 = 5) AND
-> (r8c4 = 1) AND
-> (r9c4 = 8) AND
-> (r9c6 = 6);
+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
| r1c1 | r1c2 | r1c3 | r1c4 | r1c5 | r1c6 | r1c7 | r1c8 | r1c9 | r2c1 | r2c2 | r2c3 | r2c4 | r2c5 | r2c6 | r2c7 | r2c8 | r2c9 | r3c1 | r3c2 | r3c3 | r3c4 | r3c5 | r3c6 | r3c7 | r3c8 | r3c9 | r4c1 | r4c2 | r4c3 | r4c4 | r4c5 | r4c6 | r4c7 | r4c8 | r4c9 | r5c1 | r5c2 | r5c3 | r5c4 | r5c5 | r5c6 | r5c7 | r5c8 | r5c9 | r6c1 | r6c2 | r6c3 | r6c4 | r6c5 | r6c6 | r6c7 | r6c8 | r6c9 | r7c1 | r7c2 | r7c3 | r7c4 | r7c5 | r7c6 | r7c7 | r7c8 | r7c9 | r8c1 | r8c2 | r8c3 | r8c4 | r8c5 | r8c6 | r8c7 | r8c8 | r8c9 | r9c1 | r9c2 | r9c3 | r9c4 | r9c5 | r9c6 | r9c7 | r9c8 | r9c9 |
+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
|    6 |    9 |    3 |    7 |    8 |    4 |    5 |    1 |    2 |    4 |    8 |    7 |    5 |    1 |    2 |    9 |    3 |    6 |    1 |    2 |    5 |    9 |    6 |    3 |    8 |    7 |    4 |    9 |    3 |    2 |    6 |    5 |    1 |    4 |    8 |    7 |    5 |    6 |    8 |    2 |    4 |    7 |    3 |    9 |    1 |    7 |    4 |    1 |    3 |    9 |    8 |    6 |    2 |    5 |    3 |    1 |    9 |    4 |    7 |    5 |    2 |    6 |    8 |    8 |    5 |    6 |    1 |    2 |    9 |    7 |    4 |    3 |    2 |    7 |    4 |    8 |    3 |    6 |    1 |    5 |    9 |
+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
1 row in set (7.41 sec)

sudoku17clues

Fantastique!  Nous sommes passés de 20 minutes à 7 secondes!  Mais il y a encore place à amélioration!

5. Presser encore plus fort

Maintenant que nous sommes en mesure d’obtenir des résultats dans des temps raisonnables en utilisant une table de type MEMORY, nous pouvons regarder du côté des variables système pour essayer de les optimiser.

Mais avant de se lancer dans cette entreprise, il importe d’avoir un jeu d’essai afin d’effectuer des tests reproduisibles et mesurables pour vérifier l’impact de chacun des changements sur ces variables.

Nous allons tout d’abord créer une table qui nous permettra de sauvegarder le temps d’exécution de toutes les grilles de notre jeu d’essai.

DROP TABLE IF EXISTS tests;

CREATE TABLE tests (
debut DATETIME,
fin DATETIME
) ENGINE=MYISAM;

Maintenant, nous allons créer notre jeu d’essai.  Évidemment notre échantillon de grilles est varié de façon à être représentatif afin  de mesurer chaque option de façon précise.

USE sudoku;
TRUNCATE tests;
INSERT INTO tests(debut, fin) VALUES (NOW(), NULL);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 1) AND (r1c3 = 3) AND (r1c4 = 7) AND (r1c9 = 5) AND (r2c4 = 6) AND (r2c6 = 4) AND (r3c1 = 8) AND (r4c4 = 8) AND (r4c5 = 1) AND (r5c2 = 9) AND (r5c7 = 7) AND (r6c2 = 6) AND (r6c8 = 9) AND (r7c2 = 2) AND (r7c7 = 4) AND (r8c1 = 5) AND (r8c5 = 3) AND (r9c8 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 8) AND (r1c4 = 3) AND (r1c6 = 7) AND (r2c3 = 9) AND (r3c1 = 2) AND (r3c2 = 7) AND (r3c5 = 4) AND (r4c2 = 3) AND (r4c5 = 1) AND (r5c1 = 4) AND (r5c4 = 9) AND (r5c7 = 2) AND (r5c8 = 8) AND (r6c4 = 6) AND (r6c6 = 2) AND (r6c7 = 4) AND (r6c8 = 3) AND (r7c1 = 3) AND (r7c2 = 1) AND (r7c6 = 6) AND (r8c1 = 6) AND (r8c3 = 8) AND (r8c4 = 1) AND (r8c9 = 7) AND (r9c5 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 2) AND (r1c8 = 1) AND (r2c6 = 2) AND (r2c8 = 3) AND (r2c9 = 4) AND (r3c3 = 3) AND (r3c5 = 5) AND (r4c4 = 4) AND (r4c8 = 6) AND (r5c3 = 2) AND (r5c7 = 9) AND (r6c2 = 5) AND (r6c6 = 8) AND (r7c5 = 3) AND (r7c7 = 5) AND (r8c1 = 7) AND (r8c2 = 9) AND (r8c4 = 1) AND (r9c2 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r2c2 = 8) AND (r3c5 = 5) AND (r3c6 = 3) AND (r3c8 = 8) AND (r3c9 = 9) AND (r4c2 = 2) AND (r4c3 = 4) AND (r4c6 = 9) AND (r5c5 = 1) AND (r5c9 = 5) AND (r6c2 = 1) AND (r6c6 = 7) AND (r7c3 = 2) AND (r7c4 = 1) AND (r7c7 = 3) AND (r8c1 = 9) AND (r8c6 = 5) AND (r8c9 = 7) AND (r9c1 = 5) AND (r9c5 = 8) AND (r9c8 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 5) AND (r1c6 = 8) AND (r1c7 = 6) AND (r2c6 = 6) AND (r2c7 = 2) AND (r2c8 = 7) AND (r3c2 = 1) AND (r4c1 = 9) AND (r4c4 = 7) AND (r4c5 = 6) AND (r4c6 = 2) AND (r5c1 = 7) AND (r6c3 = 8) AND (r7c1 = 2) AND (r7c3 = 3) AND (r7c7 = 8) AND (r8c4 = 1) AND (r8c5 = 9) AND (r8c9 = 5) AND (r9c3 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 5) AND (r1c4 = 8) AND (r1c5 = 3) AND (r2c7 = 7) AND (r2c8 = 1) AND (r3c2 = 3) AND (r4c1 = 7) AND (r4c4 = 4) AND (r4c7 = 8) AND (r5c1 = 1) AND (r5c3 = 2) AND (r7c2 = 8) AND (r7c4 = 6) AND (r7c7 = 4) AND (r8c1 = 9) AND (r8c6 = 2) AND (r9c5 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 7) AND (r1c9 = 5) AND (r2c2 = 3) AND (r2c8 = 7) AND (r3c1 = 2) AND (r3c3 = 5) AND (r3c8 = 3) AND (r3c9 = 8) AND (r4c8 = 8) AND (r4c9 = 9) AND (r5c1 = 5) AND (r5c3 = 8) AND (r5c4 = 2) AND (r5c6 = 9) AND (r5c7 = 7) AND (r5c9 = 4) AND (r6c1 = 3) AND (r7c1 = 6) AND (r7c3 = 4) AND (r7c4 = 9) AND (r7c5 = 8) AND (r7c6 = 7) AND (r7c7 = 5) AND (r8c1 = 9) AND (r8c4 = 5) AND (r9c4 = 4) AND (r9c6 = 6) AND (r9c9 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 4) AND (r1c2 = 6) AND (r1c3 = 8) AND (r1c7 = 1) AND (r2c2 = 7) AND (r2c4 = 4) AND (r2c6 = 8) AND (r2c8 = 5) AND (r3c4 = 6) AND (r4c3 = 6) AND (r4c4 = 1) AND (r4c5 = 8) AND (r4c6 = 3) AND (r4c9 = 7) AND (r5c3 = 7) AND (r6c1 = 3) AND (r6c5 = 5) AND (r6c7 = 2) AND (r6c9 = 1) AND (r7c6 = 7) AND (r8c4 = 8) AND (r8c6 = 2) AND (r8c7 = 5) AND (r9c6 = 5) AND (r9c7 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 9) AND (r1c8 = 1) AND (r2c6 = 2) AND (r2c8 = 3) AND (r2c9 = 4) AND (r3c3 = 5) AND (r3c5 = 6) AND (r4c4 = 3) AND (r4c8 = 7) AND (r5c3 = 2) AND (r5c7 = 6) AND (r6c2 = 1) AND (r6c6 = 5) AND (r7c5 = 8) AND (r7c7 = 2) AND (r8c1 = 7) AND (r8c2 = 3) AND (r8c4 = 9) AND (r9c2 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c6 = 7) AND (r1c9 = 2) AND (r2c5 = 4) AND (r2c6 = 5) AND (r2c8 = 7) AND (r3c3 = 9) AND (r4c1 = 3) AND (r4c5 = 5) AND (r4c7 = 8) AND (r5c1 = 4) AND (r5c2 = 8) AND (r5c4 = 9) AND (r5c6 = 1) AND (r5c9 = 7) AND (r6c3 = 7) AND (r6c6 = 4) AND (r6c7 = 2) AND (r6c9 = 9) AND (r7c5 = 1) AND (r7c7 = 3) AND (r8c8 = 5) AND (r9c2 = 3) AND (r9c4 = 8) AND (r9c5 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 9) AND (r1c8 = 7) AND (r2c8 = 2) AND (r2c9 = 4) AND (r3c1 = 1) AND (r4c2 = 2) AND (r4c3 = 9) AND (r4c9 = 5) AND (r5c6 = 1) AND (r5c7 = 6) AND (r6c2 = 4) AND (r6c5 = 8) AND (r7c4 = 4) AND (r7c5 = 3) AND (r8c1 = 5) AND (r8c7 = 8) AND (r9c4 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r2c2 = 9) AND (r2c3 = 3) AND (r3c2 = 7) AND (r3c8 = 3) AND (r4c3 = 9) AND (r4c5 = 6) AND (r4c8 = 7) AND (r4c9 = 4) AND (r5c3 = 6) AND (r5c5 = 7) AND (r5c7 = 3) AND (r5c8 = 9) AND (r6c2 = 3) AND (r6c4 = 5) AND (r6c7 = 6) AND (r6c8 = 8) AND (r7c1 = 9) AND (r7c5 = 8) AND (r7c6 = 2) AND (r7c7 = 4) AND (r8c2 = 8) AND (r8c3 = 2) AND (r8c5 = 3) AND (r8c8 = 5) AND (r8c9 = 7) AND (r9c2 = 6) AND (r9c3 = 4) AND (r9c4 = 7) AND (r9c5 = 5) AND (r9c8 = 2) AND (r9c9 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 7) AND (r1c5 = 5) AND (r1c8 = 6) AND (r1c9 = 9) AND (r2c1 = 6) AND (r2c8 = 4) AND (r3c2 = 1) AND (r3c5 = 8) AND (r3c6 = 9) AND (r3c9 = 3) AND (r4c4 = 1) AND (r5c4 = 3) AND (r6c2 = 8) AND (r6c8 = 9) AND (r7c1 = 4) AND (r7c2 = 6) AND (r8c3 = 7) AND (r8c6 = 3) AND (r8c9 = 8) AND (r9c2 = 5) AND (r9c3 = 8) AND (r9c4 = 7) AND (r9c6 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 7) AND (r1c5 = 9) AND (r1c6 = 4) AND (r2c2 = 1) AND (r2c6 = 7) AND (r3c3 = 9) AND (r3c4 = 2) AND (r3c5 = 1) AND (r4c1 = 2) AND (r4c4 = 5) AND (r4c6 = 9) AND (r5c3 = 8) AND (r5c4 = 6) AND (r6c1 = 9) AND (r6c2 = 5) AND (r6c6 = 1) AND (r6c8 = 2) AND (r6c9 = 7) AND (r7c1 = 8) AND (r7c6 = 2) AND (r7c7 = 6) AND (r8c1 = 1) AND (r8c5 = 5) AND (r8c6 = 8) AND (r8c9 = 2) AND (r9c4 = 7) AND (r9c5 = 4) AND (r9c9 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 1) AND (r1c4 = 6) AND (r1c5 = 2) AND (r2c1 = 5) AND (r2c8 = 4) AND (r2c9 = 3) AND (r3c5 = 9) AND (r4c1 = 7) AND (r4c8 = 8) AND (r5c3 = 5) AND (r5c9 = 4) AND (r6c4 = 1) AND (r7c6 = 3) AND (r7c7 = 6) AND (r8c2 = 9) AND (r8c7 = 2) AND (r9c1 = 8) AND (r9c6 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 5) AND (r1c3 = 8) AND (r1c6 = 6) AND (r1c7 = 3) AND (r1c8 = 2) AND (r1c9 = 4) AND (r2c1 = 9) AND (r2c2 = 2) AND (r2c3 = 3) AND (r2c6 = 8) AND (r2c7 = 5) AND (r2c8 = 6) AND (r3c5 = 5) AND (r4c9 = 8) AND (r5c2 = 8) AND (r5c3 = 7) AND (r5c6 = 9) AND (r7c2 = 4) AND (r7c4 = 6) AND (r7c6 = 7) AND (r7c8 = 5) AND (r8c1 = 3) AND (r8c5 = 9) AND (r8c6 = 5) AND (r8c8 = 8) AND (r8c9 = 2) AND (r9c2 = 9) AND (r9c3 = 5) AND (r9c5 = 8) AND (r9c7 = 6) AND (r9c8 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 3) AND (r1c5 = 7) AND (r1c7 = 8) AND (r2c4 = 4) AND (r2c6 = 3) AND (r3c1 = 2) AND (r3c4 = 5) AND (r3c5 = 6) AND (r3c6 = 8) AND (r3c9 = 3) AND (r4c2 = 6) AND (r4c3 = 2) AND (r4c7 = 5) AND (r4c8 = 3) AND (r5c1 = 1) AND (r5c3 = 5) AND (r5c7 = 9) AND (r5c9 = 4) AND (r6c2 = 3) AND (r6c3 = 9) AND (r6c7 = 2) AND (r6c8 = 1) AND (r7c1 = 3) AND (r7c4 = 6) AND (r7c5 = 2) AND (r7c6 = 7) AND (r7c9 = 5) AND (r8c4 = 9) AND (r8c6 = 5) AND (r9c3 = 7) AND (r9c5 = 8) AND (r9c7 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 3) AND (r1c3 = 8) AND (r2c1 = 7) AND (r2c6 = 8) AND (r3c1 = 6) AND (r3c2 = 4) AND (r3c3 = 9) AND (r3c4 = 3) AND (r3c5 = 1) AND (r3c6 = 7) AND (r3c8 = 2) AND (r4c1 = 1) AND (r4c2 = 7) AND (r4c5 = 3) AND (r4c6 = 6) AND (r4c8 = 8) AND (r4c9 = 2) AND (r5c1 = 3) AND (r5c3 = 6) AND (r5c4 = 2) AND (r5c6 = 1) AND (r5c8 = 7) AND (r5c9 = 9) AND (r6c5 = 7) AND (r7c1 = 4) AND (r7c2 = 9) AND (r7c8 = 1) AND (r8c2 = 6) AND (r8c3 = 1) AND (r8c5 = 9) AND (r8c8 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c6 = 5) AND (r1c8 = 8) AND (r2c2 = 1) AND (r2c6 = 3) AND (r3c1 = 3) AND (r3c3 = 7) AND (r3c4 = 6) AND (r4c2 = 9) AND (r4c4 = 1) AND (r4c5 = 7) AND (r4c6 = 6) AND (r4c7 = 3) AND (r5c4 = 9) AND (r5c6 = 8) AND (r5c8 = 1) AND (r6c1 = 2) AND (r7c2 = 6) AND (r8c2 = 8) AND (r8c6 = 1) AND (r8c8 = 6) AND (r9c2 = 3) AND (r9c4 = 2) AND (r9c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 8) AND (r1c7 = 4) AND (r1c9 = 3) AND (r2c1 = 9) AND (r2c4 = 3) AND (r2c7 = 7) AND (r3c2 = 1) AND (r3c3 = 5) AND (r3c6 = 2) AND (r4c1 = 6) AND (r4c8 = 9) AND (r4c9 = 5) AND (r5c2 = 3) AND (r5c3 = 7) AND (r6c4 = 8) AND (r7c7 = 8) AND (r7c8 = 3) AND (r7c9 = 2) AND (r8c2 = 2) AND (r8c5 = 9) AND (r9c1 = 8) AND (r9c4 = 7) AND (r9c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 7) AND (r1c4 = 2) AND (r1c6 = 4) AND (r1c8 = 5) AND (r2c2 = 4) AND (r2c9 = 2) AND (r3c2 = 2) AND (r3c5 = 8) AND (r3c9 = 6) AND (r4c3 = 7) AND (r4c9 = 5) AND (r5c1 = 8) AND (r5c4 = 5) AND (r6c1 = 6) AND (r6c3 = 3) AND (r6c8 = 7) AND (r7c3 = 9) AND (r7c4 = 7) AND (r8c1 = 3) AND (r8c3 = 2) AND (r8c5 = 5) AND (r8c8 = 6) AND (r9c3 = 5) AND (r9c4 = 3) AND (r9c7 = 9) AND (r9c8 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c7 = 8) AND (r1c8 = 7) AND (r2c1 = 2) AND (r2c2 = 6) AND (r3c2 = 4) AND (r3c5 = 6) AND (r3c6 = 5) AND (r4c3 = 7) AND (r5c6 = 2) AND (r5c8 = 3) AND (r6c6 = 3) AND (r6c8 = 4) AND (r6c9 = 5) AND (r7c4 = 3) AND (r8c3 = 2) AND (r8c4 = 8) AND (r8c5 = 9) AND (r8c6 = 7) AND (r9c2 = 5) AND (r9c9 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 3) AND (r1c5 = 8) AND (r1c8 = 7) AND (r1c9 = 1) AND (r2c2 = 6) AND (r2c3 = 7) AND (r3c1 = 8) AND (r5c1 = 7) AND (r5c2 = 2) AND (r5c3 = 9) AND (r5c5 = 3) AND (r5c6 = 1) AND (r5c8 = 6) AND (r5c9 = 4) AND (r6c1 = 3) AND (r6c2 = 8) AND (r6c3 = 1) AND (r7c3 = 8) AND (r7c5 = 1) AND (r7c7 = 7) AND (r7c8 = 4) AND (r8c2 = 1) AND (r8c3 = 2) AND (r8c4 = 6) AND (r8c8 = 8) AND (r8c9 = 3) AND (r9c1 = 6) AND (r9c4 = 3) AND (r9c5 = 4) AND (r9c8 = 1) AND (r9c9 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c8 = 4) AND (r2c5 = 8) AND (r2c9 = 7) AND (r3c4 = 1) AND (r3c5 = 4) AND (r3c6 = 6) AND (r3c7 = 9) AND (r3c9 = 8) AND (r4c1 = 2) AND (r4c5 = 6) AND (r4c9 = 3) AND (r5c3 = 1) AND (r5c5 = 9) AND (r5c9 = 6) AND (r6c2 = 8) AND (r6c3 = 6) AND (r6c4 = 3) AND (r6c5 = 7) AND (r6c7 = 4) AND (r7c5 = 1) AND (r7c7 = 7) AND (r8c1 = 9) AND (r8c2 = 4) AND (r8c8 = 3) AND (r8c9 = 1) AND (r9c6 = 7) AND (r9c9 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 3) AND (r1c5 = 2) AND (r1c6 = 6) AND (r2c7 = 4) AND (r2c9 = 1) AND (r3c1 = 5) AND (r4c1 = 2) AND (r4c8 = 6) AND (r5c6 = 5) AND (r5c8 = 3) AND (r6c2 = 4) AND (r6c4 = 1) AND (r7c4 = 4) AND (r7c5 = 1) AND (r7c7 = 7) AND (r8c4 = 8) AND (r9c1 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 4) AND (r1c7 = 8) AND (r1c8 = 1) AND (r2c1 = 9) AND (r2c4 = 6) AND (r2c6 = 7) AND (r3c3 = 8) AND (r3c6 = 2) AND (r3c8 = 6) AND (r4c6 = 1) AND (r4c8 = 4) AND (r4c9 = 2) AND (r5c2 = 3) AND (r6c1 = 6) AND (r6c2 = 4) AND (r7c1 = 8) AND (r7c2 = 1) AND (r8c7 = 4) AND (r8c8 = 3) AND (r9c3 = 7) AND (r9c4 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 3) AND (r1c3 = 4) AND (r1c6 = 5) AND (r1c8 = 8) AND (r2c2 = 5) AND (r2c5 = 9) AND (r2c8 = 4) AND (r2c9 = 3) AND (r3c1 = 9) AND (r3c2 = 8) AND (r3c4 = 2) AND (r3c9 = 5) AND (r4c1 = 3) AND (r4c5 = 7) AND (r4c9 = 8) AND (r5c2 = 4) AND (r5c6 = 3) AND (r5c7 = 6) AND (r5c8 = 9) AND (r6c2 = 9) AND (r6c5 = 6) AND (r6c7 = 2) AND (r7c1 = 6) AND (r7c5 = 5) AND (r7c6 = 7) AND (r8c5 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 2) AND (r1c5 = 5) AND (r1c6 = 4) AND (r1c7 = 3) AND (r1c8 = 6) AND (r1c9 = 1) AND (r2c4 = 2) AND (r3c5 = 1) AND (r3c6 = 9) AND (r4c4 = 4) AND (r4c6 = 8) AND (r5c2 = 4) AND (r5c4 = 3) AND (r5c5 = 2) AND (r5c6 = 5) AND (r5c7 = 1) AND (r5c8 = 8) AND (r6c5 = 6) AND (r6c8 = 9) AND (r6c9 = 4) AND (r7c1 = 3) AND (r7c4 = 1) AND (r7c6 = 2) AND (r7c9 = 5) AND (r8c9 = 3) AND (r9c6 = 6) AND (r9c7 = 2) AND (r9c8 = 1) AND (r9c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 1) AND (r1c5 = 6) AND (r2c2 = 3) AND (r2c7 = 5) AND (r2c9 = 4) AND (r3c5 = 2) AND (r4c8 = 7) AND (r4c9 = 2) AND (r5c3 = 1) AND (r5c4 = 5) AND (r5c5 = 7) AND (r5c7 = 9) AND (r6c2 = 4) AND (r6c8 = 1) AND (r7c2 = 9) AND (r7c3 = 2) AND (r8c4 = 7) AND (r8c7 = 6) AND (r8c8 = 3) AND (r9c8 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c3 = 5) AND (r1c9 = 2) AND (r2c4 = 9) AND (r2c6 = 1) AND (r3c1 = 3) AND (r4c2 = 6) AND (r4c4 = 7) AND (r4c7 = 4) AND (r5c1 = 2) AND (r5c5 = 5) AND (r6c8 = 6) AND (r7c4 = 3) AND (r7c5 = 8) AND (r8c2 = 1) AND (r8c7 = 7) AND (r9c2 = 4) AND (r9c8 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r2c2 = 7) AND (r2c7 = 8) AND (r2c9 = 4) AND (r3c5 = 9) AND (r3c6 = 8) AND (r3c7 = 3) AND (r3c9 = 2) AND (r4c1 = 6) AND (r4c4 = 1) AND (r4c7 = 9) AND (r5c3 = 7) AND (r5c8 = 3) AND (r6c1 = 2) AND (r6c2 = 8) AND (r6c6 = 3) AND (r6c7 = 6) AND (r7c2 = 3) AND (r7c4 = 9) AND (r7c5 = 4) AND (r7c6 = 6) AND (r7c9 = 8) AND (r8c2 = 2) AND (r9c1 = 1) AND (r9c3 = 4) AND (r9c4 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 6) AND (r1c8 = 1) AND (r2c6 = 2) AND (r2c8 = 3) AND (r2c9 = 4) AND (r3c3 = 2) AND (r3c5 = 5) AND (r4c4 = 6) AND (r4c8 = 7) AND (r5c3 = 8) AND (r5c7 = 9) AND (r6c2 = 5) AND (r6c6 = 3) AND (r7c5 = 6) AND (r7c7 = 5) AND (r8c1 = 7) AND (r8c2 = 1) AND (r8c4 = 9) AND (r9c2 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c3 = 3) AND (r1c7 = 6) AND (r1c8 = 4) AND (r2c1 = 1) AND (r2c2 = 2) AND (r2c5 = 6) AND (r2c7 = 5) AND (r3c1 = 5) AND (r3c4 = 8) AND (r3c5 = 9) AND (r3c6 = 3) AND (r3c8 = 2) AND (r3c9 = 1) AND (r4c5 = 3) AND (r5c2 = 6) AND (r5c5 = 2) AND (r5c6 = 5) AND (r5c8 = 1) AND (r5c9 = 3) AND (r6c2 = 1) AND (r6c6 = 9) AND (r6c8 = 5) AND (r7c1 = 4) AND (r7c4 = 3) AND (r7c6 = 1) AND (r8c2 = 5) AND (r9c4 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 5) AND (r1c3 = 3) AND (r1c5 = 9) AND (r2c7 = 8) AND (r2c9 = 1) AND (r3c1 = 2) AND (r4c1 = 4) AND (r4c5 = 2) AND (r4c8 = 5) AND (r5c2 = 1) AND (r5c4 = 8) AND (r6c2 = 6) AND (r6c4 = 7) AND (r7c4 = 4) AND (r7c6 = 7) AND (r7c7 = 6) AND (r8c8 = 3) AND (r9c1 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 1) AND (r1c4 = 7) AND (r1c7 = 2) AND (r1c9 = 5) AND (r2c8 = 6) AND (r2c9 = 3) AND (r3c3 = 3) AND (r3c5 = 6) AND (r4c1 = 5) AND (r4c4 = 3) AND (r4c9 = 7) AND (r6c3 = 8) AND (r6c4 = 2) AND (r6c6 = 7) AND (r6c7 = 3) AND (r6c8 = 9) AND (r7c8 = 7) AND (r8c1 = 2) AND (r8c4 = 5) AND (r8c7 = 1) AND (r9c2 = 6) AND (r9c4 = 8) AND (r9c5 = 3) AND (r9c6 = 1) AND (r9c7 = 5) AND (r9c9 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 9) AND (r1c4 = 5) AND (r1c6 = 6) AND (r1c7 = 4) AND (r1c8 = 2) AND (r2c1 = 2) AND (r2c2 = 3) AND (r2c7 = 8) AND (r2c9 = 5) AND (r3c2 = 5) AND (r3c3 = 4) AND (r3c5 = 3) AND (r3c8 = 6) AND (r3c9 = 9) AND (r4c3 = 8) AND (r4c4 = 6) AND (r4c5 = 7) AND (r4c6 = 5) AND (r6c4 = 3) AND (r6c5 = 2) AND (r6c6 = 9) AND (r6c9 = 6) AND (r7c2 = 4) AND (r7c3 = 2) AND (r7c5 = 9) AND (r7c6 = 3) AND (r7c7 = 6) AND (r8c4 = 4) AND (r8c5 = 6) AND (r9c1 = 3) AND (r9c4 = 2) AND (r9c6 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 3) AND (r1c5 = 5) AND (r2c3 = 9) AND (r2c7 = 1) AND (r3c6 = 9) AND (r3c9 = 6) AND (r4c4 = 8) AND (r4c9 = 5) AND (r5c5 = 1) AND (r5c7 = 8) AND (r5c8 = 3) AND (r6c2 = 3) AND (r6c3 = 2) AND (r6c8 = 7) AND (r7c1 = 1) AND (r7c2 = 8) AND (r7c7 = 3) AND (r8c3 = 7) AND (r8c8 = 2) AND (r9c2 = 5) AND (r9c7 = 7) AND (r9c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 6) AND (r1c7 = 8) AND (r1c9 = 7) AND (r2c3 = 3) AND (r2c8 = 4) AND (r3c1 = 2) AND (r3c2 = 9) AND (r3c5 = 7) AND (r3c9 = 6) AND (r4c4 = 9) AND (r4c7 = 2) AND (r4c9 = 3) AND (r5c4 = 2) AND (r5c5 = 6) AND (r5c9 = 9) AND (r7c1 = 3) AND (r7c2 = 8) AND (r7c5 = 2) AND (r8c3 = 7) AND (r8c7 = 1) AND (r8c9 = 4) AND (r9c4 = 1) AND (r9c8 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 4) AND (r1c8 = 1) AND (r2c6 = 1) AND (r2c8 = 2) AND (r2c9 = 3) AND (r3c5 = 5) AND (r4c4 = 6) AND (r4c8 = 4) AND (r5c3 = 3) AND (r5c7 = 5) AND (r6c2 = 7) AND (r6c6 = 2) AND (r7c5 = 4) AND (r7c7 = 8) AND (r8c1 = 2) AND (r8c2 = 1) AND (r8c4 = 8) AND (r8c8 = 7) AND (r9c2 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 5) AND (r1c5 = 7) AND (r1c7 = 4) AND (r1c8 = 1) AND (r2c3 = 7) AND (r2c4 = 2) AND (r2c7 = 3) AND (r2c9 = 9) AND (r3c5 = 4) AND (r3c7 = 7) AND (r3c9 = 2) AND (r4c3 = 8) AND (r4c6 = 2) AND (r5c4 = 3) AND (r5c5 = 9) AND (r5c7 = 2) AND (r5c8 = 4) AND (r6c2 = 3) AND (r6c4 = 4) AND (r6c9 = 5) AND (r7c4 = 9) AND (r7c5 = 2) AND (r7c7 = 5) AND (r8c4 = 8) AND (r8c5 = 1) AND (r8c6 = 4) AND (r8c9 = 7) AND (r9c1 = 8) AND (r9c6 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r2c2 = 7) AND (r2c4 = 6) AND (r2c5 = 3) AND (r3c3 = 9) AND (r3c4 = 8) AND (r3c8 = 6) AND (r4c7 = 7) AND (r4c8 = 3) AND (r5c3 = 2) AND (r5c4 = 3) AND (r5c7 = 5) AND (r5c9 = 9) AND (r6c3 = 6) AND (r6c5 = 1) AND (r6c7 = 2) AND (r7c1 = 2) AND (r7c3 = 3) AND (r7c6 = 1) AND (r8c1 = 9) AND (r8c5 = 6) AND (r8c9 = 8) AND (r9c2 = 8) AND (r9c3 = 1) AND (r9c4 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 9) AND (r2c4 = 3) AND (r2c5 = 6) AND (r2c7 = 1) AND (r3c5 = 1) AND (r3c6 = 9) AND (r3c7 = 5) AND (r4c1 = 5) AND (r4c8 = 9) AND (r4c9 = 2) AND (r5c5 = 7) AND (r6c4 = 6) AND (r6c9 = 3) AND (r7c4 = 9) AND (r7c7 = 7) AND (r7c8 = 5) AND (r8c5 = 5) AND (r8c6 = 1) AND (r8c8 = 2) AND (r9c2 = 6) AND (r9c5 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 3) AND (r1c3 = 7) AND (r2c1 = 9) AND (r2c2 = 4) AND (r2c3 = 6) AND (r2c9 = 3) AND (r3c1 = 1) AND (r3c4 = 7) AND (r4c1 = 2) AND (r4c2 = 8) AND (r4c3 = 1) AND (r4c4 = 4) AND (r5c3 = 3) AND (r5c6 = 6) AND (r6c1 = 4) AND (r7c5 = 1) AND (r7c7 = 9) AND (r7c9 = 2) AND (r8c3 = 2) AND (r8c4 = 9) AND (r8c6 = 4) AND (r8c9 = 6) AND (r9c1 = 3) AND (r9c2 = 1) AND (r9c5 = 8) AND (r9c8 = 4) AND (r9c9 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r2c1 = 4) AND (r2c2 = 2) AND (r2c3 = 9) AND (r2c5 = 8) AND (r2c6 = 3) AND (r3c2 = 8) AND (r3c4 = 5) AND (r3c6 = 4) AND (r4c5 = 2) AND (r4c7 = 4) AND (r4c8 = 7) AND (r5c2 = 4) AND (r5c4 = 8) AND (r5c6 = 9) AND (r5c8 = 5) AND (r6c3 = 2) AND (r6c4 = 1) AND (r6c7 = 3) AND (r6c9 = 8) AND (r7c2 = 9) AND (r8c1 = 8) AND (r8c5 = 7) AND (r8c6 = 2) AND (r8c9 = 4) AND (r9c4 = 9) AND (r9c5 = 1) AND (r9c6 = 8) AND (r9c9 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 2) AND (r1c7 = 4) AND (r1c9 = 9) AND (r2c2 = 4) AND (r2c8 = 5) AND (r2c9 = 2) AND (r3c3 = 5) AND (r3c7 = 8) AND (r3c8 = 7) AND (r4c2 = 8) AND (r4c8 = 9) AND (r4c9 = 6) AND (r5c3 = 7) AND (r5c6 = 9) AND (r5c7 = 2) AND (r5c8 = 3) AND (r6c3 = 2) AND (r6c5 = 3) AND (r6c7 = 7) AND (r6c9 = 8) AND (r7c2 = 5) AND (r7c5 = 8) AND (r7c7 = 9) AND (r8c1 = 2) AND (r8c3 = 6) AND (r9c3 = 8) AND (r9c4 = 5) AND (r9c6 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 9) AND (r1c5 = 6) AND (r2c3 = 2) AND (r2c7 = 6) AND (r3c2 = 1) AND (r3c6 = 9) AND (r3c7 = 5) AND (r3c9 = 3) AND (r4c2 = 7) AND (r4c7 = 8) AND (r5c1 = 1) AND (r5c8 = 3) AND (r6c3 = 9) AND (r6c9 = 5) AND (r7c2 = 8) AND (r7c6 = 3) AND (r7c9 = 9) AND (r8c1 = 7) AND (r8c3 = 5) AND (r8c6 = 2) AND (r8c7 = 1) AND (r8c9 = 6) AND (r9c1 = 6) AND (r9c8 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c7 = 3) AND (r1c8 = 1) AND (r2c1 = 7) AND (r2c4 = 5) AND (r3c1 = 2) AND (r3c5 = 4) AND (r4c2 = 3) AND (r4c3 = 9) AND (r4c6 = 8) AND (r5c8 = 6) AND (r5c9 = 2) AND (r6c2 = 1) AND (r7c1 = 5) AND (r7c4 = 6) AND (r7c9 = 7) AND (r8c2 = 8) AND (r8c7 = 9) AND (r9c5 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 5) AND (r1c3 = 1) AND (r1c5 = 7) AND (r1c8 = 6) AND (r1c9 = 3) AND (r2c2 = 6) AND (r2c8 = 2) AND (r3c2 = 2) AND (r3c3 = 3) AND (r3c5 = 6) AND (r3c7 = 7) AND (r3c8 = 9) AND (r5c2 = 1) AND (r5c7 = 3) AND (r5c8 = 5) AND (r6c3 = 9) AND (r6c8 = 4) AND (r7c1 = 6) AND (r7c4 = 4) AND (r7c6 = 9) AND (r7c7 = 5) AND (r8c1 = 5) AND (r8c2 = 9) AND (r8c4 = 6) AND (r8c5 = 3) AND (r8c8 = 7) AND (r8c9 = 4) AND (r9c3 = 4) AND (r9c4 = 7) AND (r9c5 = 5) AND (r9c8 = 3) AND (r9c9 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 7) AND (r1c8 = 9) AND (r2c6 = 2) AND (r2c8 = 3) AND (r2c9 = 4) AND (r3c3 = 2) AND (r3c5 = 5) AND (r4c4 = 4) AND (r4c8 = 2) AND (r5c3 = 6) AND (r5c7 = 7) AND (r6c2 = 5) AND (r6c6 = 3) AND (r7c5 = 6) AND (r7c7 = 5) AND (r8c1 = 8) AND (r8c2 = 1) AND (r8c4 = 9) AND (r9c2 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 1) AND (r1c8 = 8) AND (r2c6 = 1) AND (r2c8 = 2) AND (r2c9 = 3) AND (r3c3 = 4) AND (r3c5 = 5) AND (r4c4 = 2) AND (r4c8 = 6) AND (r5c3 = 7) AND (r5c7 = 8) AND (r6c2 = 5) AND (r6c6 = 9) AND (r7c5 = 7) AND (r7c7 = 5) AND (r8c1 = 6) AND (r8c2 = 3) AND (r8c4 = 8) AND (r9c2 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 2) AND (r1c3 = 7) AND (r1c5 = 3) AND (r1c6 = 4) AND (r1c8 = 6) AND (r1c9 = 5) AND (r2c6 = 8) AND (r2c9 = 2) AND (r3c3 = 4) AND (r3c7 = 7) AND (r4c1 = 4) AND (r4c9 = 3) AND (r5c1 = 8) AND (r5c3 = 2) AND (r5c7 = 6) AND (r5c8 = 4) AND (r6c2 = 7) AND (r6c9 = 8) AND (r7c2 = 2) AND (r7c3 = 1) AND (r7c5 = 8) AND (r7c8 = 5) AND (r8c1 = 6) AND (r8c2 = 4) AND (r8c5 = 2) AND (r8c6 = 5) AND (r8c7 = 3) AND (r9c1 = 5) AND (r9c6 = 7) AND (r9c9 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c8 = 8) AND (r2c1 = 3) AND (r2c4 = 5) AND (r2c6 = 7) AND (r2c7 = 1) AND (r3c6 = 1) AND (r3c8 = 6) AND (r3c9 = 3) AND (r4c3 = 2) AND (r5c1 = 8) AND (r5c3 = 7) AND (r5c7 = 2) AND (r5c8 = 3) AND (r6c1 = 5) AND (r6c5 = 7) AND (r7c2 = 8) AND (r7c5 = 4) AND (r7c6 = 3) AND (r7c8 = 2) AND (r7c9 = 1) AND (r8c1 = 1) AND (r8c3 = 5) AND (r8c9 = 6) AND (r9c1 = 4) AND (r9c2 = 3) AND (r9c7 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 3) AND (r1c8 = 1) AND (r2c6 = 2) AND (r2c8 = 3) AND (r2c9 = 4) AND (r3c3 = 5) AND (r3c5 = 7) AND (r4c4 = 4) AND (r4c8 = 5) AND (r5c3 = 7) AND (r5c7 = 6) AND (r6c2 = 8) AND (r6c6 = 1) AND (r7c5 = 5) AND (r7c7 = 8) AND (r8c1 = 1) AND (r8c2 = 2) AND (r8c4 = 3) AND (r9c2 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c5 = 3) AND (r1c6 = 1) AND (r2c1 = 3) AND (r2c4 = 4) AND (r2c5 = 2) AND (r2c8 = 6) AND (r3c4 = 6) AND (r3c6 = 9) AND (r4c5 = 7) AND (r4c6 = 3) AND (r4c7 = 4) AND (r5c2 = 7) AND (r5c4 = 1) AND (r5c6 = 2) AND (r5c7 = 5) AND (r5c8 = 3) AND (r6c4 = 5) AND (r6c5 = 4) AND (r6c8 = 1) AND (r7c2 = 1) AND (r7c7 = 3) AND (r8c1 = 5) AND (r8c2 = 3) AND (r8c7 = 6) AND (r8c8 = 9) AND (r9c2 = 6) AND (r9c3 = 9) AND (r9c5 = 1) AND (r9c6 = 4) AND (r9c7 = 2) AND (r9c8 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 8) AND (r1c7 = 4) AND (r2c2 = 2) AND (r2c6 = 1) AND (r2c8 = 9) AND (r3c5 = 7) AND (r3c9 = 5) AND (r4c4 = 4) AND (r4c7 = 8) AND (r5c5 = 5) AND (r5c9 = 7) AND (r6c1 = 1) AND (r6c6 = 9) AND (r6c8 = 2) AND (r7c1 = 9) AND (r7c6 = 6) AND (r7c7 = 1) AND (r7c8 = 3) AND (r8c1 = 2) AND (r9c1 = 6) AND (r9c3 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 3) AND (r1c3 = 4) AND (r1c4 = 6) AND (r1c7 = 9) AND (r1c8 = 2) AND (r1c9 = 1) AND (r2c1 = 2) AND (r3c2 = 1) AND (r3c3 = 9) AND (r3c9 = 5) AND (r4c2 = 4) AND (r4c3 = 2) AND (r4c9 = 9) AND (r5c2 = 9) AND (r5c3 = 6) AND (r6c1 = 3) AND (r6c4 = 9) AND (r6c8 = 6) AND (r7c2 = 2) AND (r7c3 = 1) AND (r7c5 = 4) AND (r7c6 = 9) AND (r7c8 = 5) AND (r8c4 = 5) AND (r8c6 = 6) AND (r8c8 = 1) AND (r9c4 = 2) AND (r9c5 = 1) AND (r9c7 = 7) AND (r9c9 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c9 = 4) AND (r2c2 = 3) AND (r2c3 = 1) AND (r2c6 = 9) AND (r2c9 = 7) AND (r3c1 = 2) AND (r3c2 = 9) AND (r3c6 = 1) AND (r4c2 = 7) AND (r4c6 = 6) AND (r5c6 = 2) AND (r5c9 = 9) AND (r6c4 = 7) AND (r6c5 = 4) AND (r7c1 = 5) AND (r7c5 = 1) AND (r7c8 = 2) AND (r8c2 = 6) AND (r8c5 = 9) AND (r8c8 = 7) AND (r8c9 = 3) AND (r9c3 = 3) AND (r9c8 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 4) AND (r1c6 = 2) AND (r1c7 = 5) AND (r1c8 = 6) AND (r2c4 = 7) AND (r2c9 = 3) AND (r3c2 = 1) AND (r4c1 = 6) AND (r4c5 = 9) AND (r4c6 = 8) AND (r5c5 = 1) AND (r6c9 = 4) AND (r7c7 = 1) AND (r7c8 = 8) AND (r8c1 = 4) AND (r8c4 = 3) AND (r9c1 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 7) AND (r1c4 = 4) AND (r1c5 = 2) AND (r1c6 = 6) AND (r1c7 = 1) AND (r2c2 = 4) AND (r2c4 = 3) AND (r2c5 = 7) AND (r2c8 = 2) AND (r3c3 = 6) AND (r3c5 = 1) AND (r3c6 = 5) AND (r3c8 = 7) AND (r4c1 = 6) AND (r5c2 = 8) AND (r5c4 = 5) AND (r6c1 = 4) AND (r6c2 = 5) AND (r6c3 = 2) AND (r6c5 = 6) AND (r6c6 = 3) AND (r7c1 = 5) AND (r7c4 = 7) AND (r7c9 = 2) AND (r8c1 = 7) AND (r8c9 = 1) AND (r9c1 = 3) AND (r9c3 = 4) AND (r9c4 = 6) AND (r9c5 = 5) AND (r9c6 = 2) AND (r9c9 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 9) AND (r1c7 = 3) AND (r1c9 = 6) AND (r2c1 = 7) AND (r2c4 = 6) AND (r2c6 = 4) AND (r2c7 = 8) AND (r3c1 = 6) AND (r3c2 = 1) AND (r3c5 = 3) AND (r3c9 = 7) AND (r4c1 = 1) AND (r4c2 = 6) AND (r4c7 = 4) AND (r4c9 = 3) AND (r5c6 = 1) AND (r5c7 = 7) AND (r6c2 = 8) AND (r6c4 = 4) AND (r6c5 = 9) AND (r6c8 = 1) AND (r7c2 = 9) AND (r7c5 = 4) AND (r8c9 = 4) AND (r9c1 = 2) AND (r9c2 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 4) AND (r1c2 = 3) AND (r1c5 = 7) AND (r1c6 = 6) AND (r1c7 = 5) AND (r1c8 = 9) AND (r2c2 = 6) AND (r2c3 = 5) AND (r2c5 = 4) AND (r3c4 = 5) AND (r3c5 = 9) AND (r3c7 = 3) AND (r4c2 = 1) AND (r4c6 = 8) AND (r4c7 = 4) AND (r4c8 = 5) AND (r5c1 = 3) AND (r5c2 = 7) AND (r5c4 = 6) AND (r5c6 = 4) AND (r5c7 = 1) AND (r5c9 = 9) AND (r6c5 = 1) AND (r6c6 = 9) AND (r6c8 = 7) AND (r6c9 = 3) AND (r7c2 = 9) AND (r7c5 = 8) AND (r8c2 = 5) AND (r8c5 = 6) AND (r8c6 = 7) AND (r8c7 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c2 = 4) AND (r1c6 = 6) AND (r1c8 = 2) AND (r2c3 = 6) AND (r2c9 = 9) AND (r3c7 = 1) AND (r4c5 = 9) AND (r4c8 = 3) AND (r5c1 = 3) AND (r5c2 = 6) AND (r5c7 = 9) AND (r6c3 = 2) AND (r6c4 = 8) AND (r7c2 = 9) AND (r7c7 = 4) AND (r7c8 = 7) AND (r8c2 = 7) AND (r8c3 = 1) AND (r8c5 = 4) AND (r8c7 = 6) AND (r8c9 = 8) AND (r9c1 = 2) AND (r9c9 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 2) AND (r1c4 = 3) AND (r1c6 = 8) AND (r1c8 = 6) AND (r2c1 = 8) AND (r2c5 = 7) AND (r2c9 = 2) AND (r3c3 = 6) AND (r3c4 = 5) AND (r3c6 = 2) AND (r3c7 = 8) AND (r4c1 = 6) AND (r4c3 = 2) AND (r4c7 = 7) AND (r4c9 = 3) AND (r5c2 = 9) AND (r5c8 = 2) AND (r6c1 = 3) AND (r6c3 = 5) AND (r6c7 = 9) AND (r6c9 = 4) AND (r7c3 = 7) AND (r7c4 = 2) AND (r7c6 = 1) AND (r7c7 = 6) AND (r8c1 = 5) AND (r8c5 = 6) AND (r8c9 = 1) AND (r9c2 = 6) AND (r9c4 = 4) AND (r9c6 = 5) AND (r9c8 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 2) AND (r1c3 = 4) AND (r1c8 = 3) AND (r1c9 = 1) AND (r2c1 = 9) AND (r2c3 = 6) AND (r2c4 = 4) AND (r2c5 = 5) AND (r3c3 = 3) AND (r3c5 = 7) AND (r3c8 = 6) AND (r5c1 = 4) AND (r5c8 = 7) AND (r5c9 = 9) AND (r6c4 = 5) AND (r6c5 = 6) AND (r7c1 = 1) AND (r7c4 = 2) AND (r8c1 = 6) AND (r8c2 = 7) AND (r8c5 = 4) AND (r9c5 = 9) AND (r9c6 = 7) AND (r9c8 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 6) AND (r1c7 = 4) AND (r2c1 = 9) AND (r2c3 = 3) AND (r3c4 = 4) AND (r3c8 = 2) AND (r4c9 = 9) AND (r5c1 = 2) AND (r5c7 = 3) AND (r6c5 = 3) AND (r6c6 = 1) AND (r6c7 = 7) AND (r7c1 = 5) AND (r7c2 = 9) AND (r7c3 = 7) AND (r8c1 = 4) AND (r8c4 = 9) AND (r9c2 = 2) AND (r9c7 = 6) AND (r9c9 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 5) AND (r1c4 = 7) AND (r1c8 = 3) AND (r2c2 = 8) AND (r2c6 = 9) AND (r2c9 = 5) AND (r3c4 = 1) AND (r3c7 = 6) AND (r3c9 = 2) AND (r4c8 = 9) AND (r5c5 = 6) AND (r6c4 = 3) AND (r6c6 = 1) AND (r7c2 = 7) AND (r7c8 = 8) AND (r8c1 = 6) AND (r8c4 = 2) AND (r8c5 = 8) AND (r8c7 = 3) AND (r9c1 = 1) AND (r9c2 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c7 = 7) AND (r2c2 = 4) AND (r2c7 = 1) AND (r2c9 = 3) AND (r3c6 = 9) AND (r3c8 = 6) AND (r3c9 = 5) AND (r4c3 = 4) AND (r5c2 = 3) AND (r5c3 = 7) AND (r5c4 = 2) AND (r5c8 = 9) AND (r6c4 = 1) AND (r7c1 = 7) AND (r7c5 = 1) AND (r7c7 = 6) AND (r8c3 = 5) AND (r8c6 = 7) AND (r8c7 = 2) AND (r9c5 = 6) AND (r9c6 = 5) AND (r9c8 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 2) AND (r1c5 = 3) AND (r1c8 = 5) AND (r2c2 = 8) AND (r2c9 = 1) AND (r3c2 = 9) AND (r4c1 = 5) AND (r4c6 = 1) AND (r4c8 = 3) AND (r5c5 = 8) AND (r5c7 = 9) AND (r6c1 = 2) AND (r7c2 = 4) AND (r7c4 = 6) AND (r7c7 = 8) AND (r8c1 = 7) AND (r8c4 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 6) AND (r1c5 = 4) AND (r1c6 = 1) AND (r1c7 = 8) AND (r1c9 = 5) AND (r2c3 = 8) AND (r2c6 = 2) AND (r2c7 = 4) AND (r2c9 = 1) AND (r3c1 = 1) AND (r3c3 = 4) AND (r3c4 = 5) AND (r3c5 = 8) AND (r3c8 = 6) AND (r4c3 = 1) AND (r4c5 = 3) AND (r4c9 = 4) AND (r6c6 = 9) AND (r6c9 = 3) AND (r7c2 = 2) AND (r7c3 = 6) AND (r8c1 = 5) AND (r8c3 = 9) AND (r8c5 = 1) AND (r8c6 = 4) AND (r8c8 = 2) AND (r8c9 = 6) AND (r9c1 = 4) AND (r9c5 = 6) AND (r9c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 3) AND (r1c4 = 2) AND (r2c1 = 5) AND (r2c5 = 8) AND (r2c7 = 6) AND (r2c9 = 4) AND (r3c9 = 9) AND (r4c1 = 3) AND (r4c4 = 4) AND (r4c5 = 5) AND (r5c3 = 8) AND (r5c4 = 1) AND (r5c5 = 9) AND (r5c6 = 6) AND (r6c1 = 4) AND (r6c5 = 3) AND (r6c7 = 1) AND (r6c9 = 6) AND (r7c1 = 1) AND (r7c4 = 6) AND (r7c7 = 9) AND (r7c8 = 5) AND (r7c9 = 8) AND (r8c4 = 5) AND (r9c1 = 8) AND (r9c2 = 6) AND (r9c7 = 4) AND (r9c9 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 6) AND (r1c3 = 4) AND (r1c4 = 3) AND (r1c5 = 1) AND (r1c9 = 5) AND (r2c2 = 2) AND (r2c5 = 5) AND (r2c7 = 6) AND (r2c9 = 4) AND (r3c3 = 8) AND (r3c5 = 6) AND (r3c6 = 4) AND (r3c8 = 2) AND (r4c3 = 1) AND (r4c7 = 9) AND (r4c9 = 2) AND (r5c2 = 3) AND (r6c1 = 8) AND (r6c5 = 2) AND (r6c6 = 6) AND (r6c9 = 1) AND (r7c4 = 5) AND (r7c5 = 9) AND (r8c1 = 3) AND (r8c6 = 8) AND (r9c1 = 9) AND (r9c5 = 4) AND (r9c6 = 3) AND (r9c8 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c6 = 1) AND (r1c8 = 7) AND (r1c9 = 3) AND (r2c4 = 5) AND (r2c5 = 6) AND (r2c7 = 8) AND (r2c8 = 4) AND (r3c4 = 3) AND (r3c6 = 8) AND (r3c7 = 6) AND (r4c5 = 5) AND (r4c6 = 2) AND (r4c7 = 7) AND (r4c9 = 6) AND (r5c4 = 7) AND (r5c5 = 1) AND (r5c8 = 3) AND (r7c1 = 2) AND (r7c2 = 7) AND (r7c8 = 6) AND (r7c9 = 8) AND (r8c2 = 4) AND (r8c3 = 5) AND (r8c4 = 1) AND (r9c1 = 6) AND (r9c2 = 8) AND (r9c3 = 3) AND (r9c6 = 7) AND (r9c9 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c5 = 5) AND (r1c8 = 1) AND (r2c1 = 5) AND (r2c2 = 8) AND (r3c5 = 7) AND (r4c4 = 7) AND (r4c5 = 2) AND (r4c6 = 4) AND (r4c7 = 1) AND (r4c8 = 8) AND (r5c1 = 1) AND (r5c5 = 8) AND (r5c9 = 9) AND (r6c2 = 7) AND (r6c4 = 1) AND (r6c5 = 3) AND (r6c8 = 4) AND (r7c1 = 3) AND (r7c3 = 2) AND (r7c5 = 9) AND (r7c7 = 8) AND (r7c8 = 5) AND (r7c9 = 4) AND (r8c2 = 9) AND (r8c3 = 7) AND (r8c7 = 2) AND (r9c1 = 8) AND (r9c3 = 5) AND (r9c6 = 2) AND (r9c8 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 4) AND (r1c6 = 7) AND (r1c9 = 2) AND (r2c1 = 5) AND (r2c2 = 2) AND (r2c4 = 9) AND (r2c5 = 3) AND (r2c7 = 4) AND (r3c4 = 5) AND (r3c9 = 7) AND (r4c1 = 9) AND (r4c2 = 3) AND (r4c9 = 4) AND (r5c9 = 1) AND (r6c6 = 1) AND (r6c7 = 3) AND (r7c3 = 4) AND (r7c5 = 2) AND (r8c1 = 2) AND (r8c2 = 9) AND (r8c5 = 7) AND (r9c1 = 1) AND (r9c5 = 8) AND (r9c6 = 5) AND (r9c8 = 2) AND (r9c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 4) AND (r1c7 = 7) AND (r1c8 = 5) AND (r1c9 = 3) AND (r2c2 = 7) AND (r2c3 = 9) AND (r2c6 = 3) AND (r2c7 = 2) AND (r2c8 = 1) AND (r3c3 = 5) AND (r4c5 = 2) AND (r5c3 = 4) AND (r5c5 = 3) AND (r5c7 = 1) AND (r5c9 = 7) AND (r6c1 = 3) AND (r6c3 = 6) AND (r6c4 = 1) AND (r6c7 = 4) AND (r6c8 = 2) AND (r7c1 = 2) AND (r7c3 = 3) AND (r7c6 = 6) AND (r7c7 = 5) AND (r7c9 = 1) AND (r8c2 = 6) AND (r8c3 = 7) AND (r8c5 = 1) AND (r8c8 = 4) AND (r8c9 = 2) AND (r9c7 = 6) AND (r9c8 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 3) AND (r1c3 = 7) AND (r1c8 = 5) AND (r2c3 = 9) AND (r2c5 = 6) AND (r2c8 = 1) AND (r3c6 = 1) AND (r3c7 = 3) AND (r4c2 = 7) AND (r5c3 = 1) AND (r5c4 = 2) AND (r5c6 = 7) AND (r5c9 = 5) AND (r6c5 = 3) AND (r6c7 = 8) AND (r6c9 = 6) AND (r7c6 = 3) AND (r8c4 = 7) AND (r8c5 = 8) AND (r9c1 = 6) AND (r9c8 = 9) AND (r9c9 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 3) AND (r1c7 = 5) AND (r1c8 = 9) AND (r2c2 = 5) AND (r2c3 = 1) AND (r2c5 = 6) AND (r2c6 = 3) AND (r3c3 = 9) AND (r3c5 = 2) AND (r5c2 = 7) AND (r5c3 = 3) AND (r5c5 = 5) AND (r5c8 = 2) AND (r6c3 = 2) AND (r6c7 = 1) AND (r6c8 = 7) AND (r7c2 = 9) AND (r7c4 = 7) AND (r7c6 = 6) AND (r7c7 = 3) AND (r7c8 = 5) AND (r8c1 = 7) AND (r8c2 = 8) AND (r9c5 = 8) AND (r9c9 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r2c4 = 4) AND (r2c8 = 5) AND (r3c1 = 8) AND (r3c2 = 5) AND (r3c3 = 9) AND (r3c4 = 2) AND (r4c3 = 3) AND (r4c4 = 5) AND (r4c7 = 4) AND (r4c8 = 9) AND (r5c7 = 5) AND (r5c9 = 6) AND (r6c3 = 7) AND (r6c4 = 9) AND (r6c5 = 2) AND (r6c6 = 4) AND (r6c8 = 3) AND (r6c9 = 8) AND (r7c6 = 2) AND (r7c8 = 8) AND (r8c1 = 7) AND (r8c4 = 8) AND (r8c5 = 5) AND (r8c7 = 9) AND (r8c8 = 4) AND (r9c2 = 3) AND (r9c4 = 7) AND (r9c5 = 4) AND (r9c8 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 9) AND (r1c7 = 6) AND (r2c1 = 8) AND (r2c3 = 6) AND (r2c4 = 7) AND (r2c5 = 4) AND (r2c6 = 5) AND (r2c8 = 2) AND (r2c9 = 9) AND (r3c3 = 4) AND (r3c6 = 3) AND (r3c8 = 7) AND (r3c9 = 5) AND (r4c1 = 4) AND (r4c4 = 3) AND (r4c5 = 7) AND (r4c6 = 9) AND (r4c8 = 6) AND (r5c6 = 4) AND (r6c1 = 7) AND (r6c5 = 8) AND (r6c8 = 5) AND (r7c3 = 8) AND (r7c4 = 4) AND (r7c6 = 6) AND (r8c1 = 3) AND (r8c5 = 5) AND (r8c6 = 8) AND (r9c4 = 2) AND (r9c5 = 3) AND (r9c9 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c5 = 7) AND (r3c3 = 3) AND (r3c5 = 2) AND (r3c8 = 5) AND (r4c2 = 6) AND (r4c5 = 4) AND (r4c9 = 2) AND (r5c3 = 8) AND (r5c4 = 5) AND (r5c6 = 9) AND (r6c4 = 6) AND (r7c1 = 6) AND (r7c8 = 9) AND (r8c3 = 2) AND (r8c5 = 3) AND (r8c9 = 4) AND (r9c1 = 4) AND (r9c2 = 7) AND (r9c4 = 8) AND (r9c7 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 3) AND (r1c4 = 4) AND (r1c6 = 6) AND (r2c2 = 9) AND (r2c7 = 7) AND (r4c1 = 6) AND (r4c3 = 4) AND (r4c4 = 1) AND (r5c5 = 7) AND (r5c7 = 2) AND (r5c9 = 9) AND (r6c7 = 5) AND (r7c5 = 3) AND (r7c8 = 8) AND (r8c1 = 5) AND (r8c2 = 2) AND (r9c4 = 8) AND (r9c8 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 7) AND (r1c5 = 2) AND (r2c2 = 8) AND (r2c6 = 6) AND (r3c6 = 3) AND (r3c9 = 6) AND (r4c3 = 3) AND (r4c5 = 4) AND (r4c7 = 7) AND (r4c8 = 8) AND (r5c1 = 2) AND (r5c5 = 1) AND (r6c2 = 6) AND (r6c9 = 5) AND (r7c4 = 1) AND (r7c7 = 3) AND (r7c8 = 7) AND (r8c5 = 5) AND (r9c3 = 8) AND (r9c6 = 7) AND (r9c8 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c8 = 8) AND (r2c1 = 3) AND (r2c2 = 5) AND (r2c3 = 1) AND (r2c5 = 7) AND (r3c6 = 9) AND (r3c7 = 7) AND (r3c9 = 3) AND (r4c3 = 7) AND (r4c4 = 1) AND (r4c6 = 8) AND (r4c7 = 5) AND (r5c5 = 3) AND (r5c7 = 2) AND (r6c2 = 8) AND (r6c6 = 5) AND (r6c8 = 9) AND (r7c7 = 1) AND (r7c8 = 5) AND (r7c9 = 2) AND (r8c3 = 3) AND (r8c4 = 4) AND (r8c6 = 1) AND (r9c4 = 9) AND (r9c5 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c7 = 3) AND (r1c9 = 8) AND (r2c1 = 7) AND (r2c2 = 2) AND (r2c4 = 9) AND (r2c9 = 6) AND (r3c4 = 1) AND (r4c2 = 8) AND (r4c6 = 6) AND (r5c3 = 7) AND (r5c5 = 5) AND (r5c8 = 6) AND (r6c1 = 3) AND (r6c5 = 2) AND (r7c1 = 5) AND (r7c3 = 8) AND (r7c4 = 7) AND (r7c5 = 1) AND (r8c6 = 9) AND (r9c1 = 2) AND (r9c3 = 6) AND (r9c9 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 5) AND (r1c3 = 2) AND (r1c4 = 9) AND (r2c7 = 8) AND (r3c8 = 4) AND (r3c9 = 6) AND (r4c2 = 1) AND (r4c6 = 2) AND (r4c9 = 3) AND (r5c1 = 3) AND (r5c2 = 7) AND (r6c6 = 4) AND (r7c8 = 7) AND (r8c1 = 6) AND (r8c4 = 5) AND (r8c6 = 1) AND (r9c1 = 4) AND (r9c4 = 3) AND (r9c6 = 9) AND (r9c7 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 7) AND (r1c5 = 6) AND (r1c6 = 4) AND (r1c8 = 2) AND (r1c9 = 5) AND (r2c2 = 5) AND (r2c6 = 9) AND (r2c9 = 1) AND (r3c5 = 2) AND (r3c8 = 4) AND (r3c9 = 9) AND (r4c1 = 5) AND (r4c3 = 6) AND (r4c6 = 3) AND (r4c8 = 1) AND (r5c1 = 4) AND (r5c3 = 2) AND (r6c2 = 1) AND (r7c1 = 3) AND (r7c2 = 6) AND (r7c3 = 9) AND (r7c4 = 4) AND (r7c8 = 5) AND (r8c3 = 5) AND (r8c6 = 6) AND (r9c1 = 7) AND (r9c9 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 9) AND (r1c5 = 6) AND (r1c6 = 5) AND (r1c9 = 7) AND (r2c1 = 5) AND (r2c6 = 3) AND (r2c8 = 6) AND (r2c9 = 8) AND (r3c3 = 8) AND (r3c4 = 4) AND (r3c9 = 9) AND (r4c3 = 2) AND (r5c5 = 5) AND (r5c9 = 3) AND (r6c3 = 6) AND (r6c6 = 7) AND (r7c5 = 9) AND (r7c7 = 2) AND (r8c4 = 3) AND (r8c7 = 4) AND (r9c1 = 6) AND (r9c8 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 7) AND (r1c4 = 3) AND (r1c8 = 6) AND (r2c5 = 8) AND (r2c7 = 5) AND (r3c2 = 1) AND (r4c1 = 8) AND (r4c3 = 9) AND (r4c4 = 6) AND (r4c7 = 4) AND (r5c4 = 1) AND (r5c6 = 2) AND (r6c1 = 5) AND (r7c4 = 7) AND (r7c8 = 3) AND (r7c9 = 2) AND (r8c1 = 4) AND (r8c5 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c6 = 4) AND (r1c8 = 6) AND (r2c4 = 1) AND (r2c5 = 2) AND (r2c6 = 9) AND (r2c8 = 8) AND (r2c9 = 4) AND (r3c3 = 2) AND (r4c3 = 5) AND (r4c7 = 4) AND (r5c2 = 2) AND (r5c4 = 4) AND (r5c5 = 1) AND (r5c7 = 8) AND (r5c8 = 5) AND (r6c2 = 6) AND (r6c4 = 5) AND (r6c6 = 8) AND (r6c8 = 2) AND (r7c1 = 2) AND (r7c2 = 1) AND (r7c3 = 6) AND (r7c6 = 5) AND (r8c2 = 8) AND (r8c4 = 2) AND (r8c5 = 3) AND (r9c2 = 3) AND (r9c3 = 4) AND (r9c4 = 8) AND (r9c6 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 8) AND (r1c7 = 1) AND (r1c9 = 4) AND (r2c1 = 7) AND (r2c2 = 3) AND (r4c5 = 7) AND (r4c6 = 2) AND (r4c7 = 6) AND (r5c2 = 1) AND (r5c3 = 3) AND (r7c3 = 4) AND (r7c4 = 3) AND (r7c5 = 1) AND (r8c1 = 2) AND (r8c7 = 5) AND (r8c8 = 7) AND (r9c8 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 9) AND (r1c5 = 4) AND (r1c8 = 8) AND (r2c2 = 4) AND (r2c9 = 7) AND (r3c4 = 6) AND (r3c9 = 2) AND (r4c3 = 5) AND (r4c7 = 7) AND (r4c8 = 4) AND (r5c1 = 9) AND (r5c2 = 6) AND (r5c7 = 5) AND (r6c4 = 2) AND (r7c2 = 5) AND (r7c5 = 2) AND (r7c9 = 8) AND (r8c3 = 4) AND (r8c5 = 8) AND (r8c6 = 3) AND (r9c2 = 8) AND (r9c4 = 9) AND (r9c5 = 7) AND (r9c8 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 2) AND (r1c5 = 6) AND (r1c8 = 8) AND (r2c1 = 9) AND (r2c3 = 4) AND (r4c2 = 8) AND (r4c4 = 5) AND (r4c8 = 6) AND (r5c1 = 7) AND (r5c6 = 9) AND (r6c9 = 1) AND (r7c2 = 2) AND (r7c4 = 6) AND (r8c5 = 3) AND (r8c7 = 9) AND (r9c1 = 1) AND (r9c7 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 4) AND (r1c3 = 8) AND (r1c4 = 9) AND (r1c6 = 7) AND (r1c7 = 1) AND (r3c4 = 4) AND (r3c5 = 3) AND (r3c6 = 1) AND (r4c6 = 4) AND (r5c5 = 9) AND (r5c7 = 7) AND (r6c1 = 6) AND (r6c5 = 2) AND (r6c6 = 3) AND (r7c2 = 7) AND (r7c6 = 8) AND (r7c7 = 3) AND (r7c9 = 9) AND (r8c1 = 1) AND (r8c3 = 3) AND (r8c5 = 7) AND (r8c6 = 2) AND (r8c7 = 8) AND (r8c9 = 4) AND (r9c2 = 8) AND (r9c3 = 4) AND (r9c7 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 7) AND (r1c3 = 5) AND (r1c7 = 8) AND (r1c8 = 2) AND (r2c1 = 2) AND (r2c2 = 9) AND (r2c3 = 8) AND (r2c4 = 7) AND (r3c1 = 4) AND (r3c2 = 3) AND (r3c8 = 5) AND (r3c9 = 9) AND (r4c1 = 8) AND (r4c4 = 3) AND (r4c5 = 4) AND (r4c6 = 6) AND (r5c4 = 2) AND (r5c7 = 3) AND (r6c5 = 5) AND (r6c6 = 7) AND (r7c5 = 6) AND (r7c6 = 4) AND (r8c4 = 8) AND (r8c6 = 9) AND (r8c8 = 4) AND (r9c4 = 5) AND (r9c5 = 3) AND (r9c7 = 6) AND (r9c8 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 1) AND (r1c8 = 8) AND (r2c8 = 6) AND (r3c3 = 8) AND (r3c4 = 4) AND (r3c7 = 1) AND (r4c1 = 5) AND (r4c3 = 6) AND (r4c7 = 4) AND (r5c5 = 9) AND (r5c8 = 5) AND (r5c9 = 7) AND (r6c5 = 8) AND (r6c6 = 4) AND (r7c4 = 8) AND (r7c6 = 7) AND (r7c7 = 2) AND (r8c2 = 2) AND (r8c3 = 7) AND (r8c5 = 1) AND (r9c2 = 5) AND (r9c4 = 6) AND (r9c6 = 2) AND (r9c7 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 6) AND (r1c4 = 3) AND (r1c6 = 1) AND (r2c5 = 8) AND (r2c9 = 1) AND (r3c2 = 8) AND (r3c4 = 9) AND (r3c5 = 5) AND (r3c6 = 7) AND (r3c8 = 3) AND (r4c1 = 9) AND (r4c3 = 8) AND (r4c5 = 3) AND (r4c6 = 4) AND (r4c8 = 6) AND (r5c6 = 9) AND (r6c4 = 1) AND (r6c5 = 7) AND (r6c6 = 8) AND (r6c8 = 9) AND (r6c9 = 5) AND (r7c1 = 8) AND (r7c2 = 6) AND (r7c6 = 5) AND (r7c7 = 7) AND (r7c8 = 1) AND (r8c1 = 7) AND (r8c3 = 1) AND (r8c6 = 3) AND (r8c7 = 5) AND (r8c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c8 = 4) AND (r2c1 = 6) AND (r2c4 = 3) AND (r2c5 = 8) AND (r2c9 = 7) AND (r3c4 = 7) AND (r3c5 = 9) AND (r3c6 = 6) AND (r4c4 = 6) AND (r4c8 = 3) AND (r5c5 = 1) AND (r6c3 = 7) AND (r6c4 = 4) AND (r6c9 = 2) AND (r7c2 = 4) AND (r7c4 = 8) AND (r7c9 = 6) AND (r8c1 = 3) AND (r8c2 = 1) AND (r9c2 = 9) AND (r9c7 = 2) AND (r9c8 = 1) AND (r9c9 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 1) AND (r1c7 = 6) AND (r2c2 = 4) AND (r2c3 = 3) AND (r2c8 = 8) AND (r2c9 = 5) AND (r3c1 = 6) AND (r3c4 = 5) AND (r3c9 = 2) AND (r4c6 = 3) AND (r4c7 = 2) AND (r5c3 = 5) AND (r5c5 = 1) AND (r5c6 = 7) AND (r5c8 = 6) AND (r5c9 = 8) AND (r6c4 = 8) AND (r6c6 = 5) AND (r6c9 = 1) AND (r7c3 = 2) AND (r7c6 = 6) AND (r7c7 = 1) AND (r7c8 = 3) AND (r7c9 = 4) AND (r8c1 = 4) AND (r8c6 = 1) AND (r8c8 = 2) AND (r8c9 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 4) AND (r1c5 = 2) AND (r1c6 = 9) AND (r1c7 = 3) AND (r1c8 = 6) AND (r2c1 = 3) AND (r2c2 = 8) AND (r2c4 = 1) AND (r2c5 = 4) AND (r2c8 = 2) AND (r3c2 = 9) AND (r4c2 = 1) AND (r4c3 = 9) AND (r4c4 = 8) AND (r4c7 = 4) AND (r5c4 = 4) AND (r5c5 = 9) AND (r5c9 = 7) AND (r6c6 = 3) AND (r7c1 = 8) AND (r7c3 = 6) AND (r8c3 = 7) AND (r8c7 = 8) AND (r9c6 = 2) AND (r9c8 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 1) AND (r1c8 = 6) AND (r2c1 = 6) AND (r2c5 = 7) AND (r2c6 = 2) AND (r3c9 = 9) AND (r4c1 = 1) AND (r4c2 = 8) AND (r4c4 = 2) AND (r4c7 = 5) AND (r6c6 = 5) AND (r6c8 = 9) AND (r6c9 = 4) AND (r7c1 = 7) AND (r7c2 = 5) AND (r7c7 = 9) AND (r8c1 = 4) AND (r8c6 = 6) AND (r8c7 = 8) AND (r8c8 = 5) AND (r9c3 = 6) AND (r9c5 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 6) AND (r1c6 = 7) AND (r1c7 = 5) AND (r2c5 = 5) AND (r2c8 = 6) AND (r2c9 = 4) AND (r3c2 = 5) AND (r3c5 = 6) AND (r3c7 = 9) AND (r3c8 = 8) AND (r3c9 = 1) AND (r4c1 = 1) AND (r5c3 = 7) AND (r5c4 = 9) AND (r5c9 = 2) AND (r6c2 = 9) AND (r6c7 = 1) AND (r7c3 = 4) AND (r7c5 = 1) AND (r7c6 = 5) AND (r7c9 = 9) AND (r8c1 = 8) AND (r8c5 = 7) AND (r8c9 = 6) AND (r9c6 = 2) AND (r9c8 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 9) AND (r1c5 = 6) AND (r2c2 = 2) AND (r2c3 = 7) AND (r2c5 = 9) AND (r2c6 = 1) AND (r2c9 = 5) AND (r3c3 = 3) AND (r3c4 = 7) AND (r3c6 = 8) AND (r4c8 = 3) AND (r5c1 = 5) AND (r5c3 = 6) AND (r5c5 = 2) AND (r5c6 = 9) AND (r5c7 = 7) AND (r6c1 = 2) AND (r6c3 = 1) AND (r6c6 = 7) AND (r7c1 = 3) AND (r7c3 = 9) AND (r7c6 = 6) AND (r7c7 = 1) AND (r7c8 = 2) AND (r8c2 = 6) AND (r8c3 = 5) AND (r8c5 = 1) AND (r8c6 = 2) AND (r9c1 = 1) AND (r9c4 = 9) AND (r9c5 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 3) AND (r1c7 = 7) AND (r1c8 = 6) AND (r2c1 = 8) AND (r2c5 = 2) AND (r2c6 = 6) AND (r2c8 = 5) AND (r3c1 = 4) AND (r3c2 = 5) AND (r4c8 = 1) AND (r5c3 = 2) AND (r5c4 = 8) AND (r5c6 = 5) AND (r5c8 = 3) AND (r5c9 = 7) AND (r6c9 = 8) AND (r7c1 = 2) AND (r7c3 = 8) AND (r7c4 = 6) AND (r8c2 = 3) AND (r8c4 = 5) AND (r8c7 = 6) AND (r8c8 = 2) AND (r9c3 = 7) AND (r9c6 = 2) AND (r9c9 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 9) AND (r2c2 = 1) AND (r2c5 = 8) AND (r2c6 = 6) AND (r2c7 = 4) AND (r3c2 = 4) AND (r4c3 = 8) AND (r4c7 = 1) AND (r4c8 = 3) AND (r5c1 = 5) AND (r5c2 = 3) AND (r6c2 = 7) AND (r6c3 = 1) AND (r6c5 = 3) AND (r6c7 = 5) AND (r7c3 = 7) AND (r7c4 = 4) AND (r7c8 = 1) AND (r8c2 = 5) AND (r8c3 = 4) AND (r8c4 = 7) AND (r8c5 = 9) AND (r8c7 = 6) AND (r8c9 = 8) AND (r9c2 = 6) AND (r9c3 = 9) AND (r9c4 = 8) AND (r9c5 = 5) AND (r9c6 = 1) AND (r9c7 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 7) AND (r1c3 = 8) AND (r1c5 = 2) AND (r2c8 = 9) AND (r2c9 = 1) AND (r3c1 = 3) AND (r4c2 = 4) AND (r4c3 = 6) AND (r5c5 = 3) AND (r5c7 = 7) AND (r6c4 = 5) AND (r7c2 = 5) AND (r7c4 = 9) AND (r7c6 = 6) AND (r8c4 = 4) AND (r8c8 = 1) AND (r9c1 = 2) AND (r9c7 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c7 = 3) AND (r1c9 = 2) AND (r2c3 = 8) AND (r3c5 = 5) AND (r4c9 = 4) AND (r5c2 = 5) AND (r5c5 = 7) AND (r5c8 = 2) AND (r6c2 = 7) AND (r6c4 = 3) AND (r6c5 = 8) AND (r6c6 = 4) AND (r6c8 = 5) AND (r7c2 = 9) AND (r7c3 = 7) AND (r7c6 = 8) AND (r7c9 = 5) AND (r8c2 = 8) AND (r8c3 = 2) AND (r8c5 = 1) AND (r8c6 = 7) AND (r8c8 = 4) AND (r9c2 = 1) AND (r9c3 = 5) AND (r9c4 = 4) AND (r9c5 = 2) AND (r9c9 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 7) AND (r1c6 = 5) AND (r2c1 = 6) AND (r2c9 = 4) AND (r3c1 = 8) AND (r3c2 = 5) AND (r3c6 = 7) AND (r4c6 = 8) AND (r4c9 = 6) AND (r5c1 = 9) AND (r5c2 = 6) AND (r5c5 = 4) AND (r5c7 = 5) AND (r6c3 = 1) AND (r6c6 = 3) AND (r6c7 = 8) AND (r7c3 = 4) AND (r7c5 = 7) AND (r8c1 = 3) AND (r8c4 = 8) AND (r8c7 = 9) AND (r8c9 = 7) AND (r9c2 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 8) AND (r1c5 = 7) AND (r1c8 = 2) AND (r2c7 = 6) AND (r2c9 = 4) AND (r3c3 = 6) AND (r3c4 = 9) AND (r3c6 = 5) AND (r3c7 = 3) AND (r4c4 = 5) AND (r4c6 = 7) AND (r5c5 = 9) AND (r5c8 = 8) AND (r5c9 = 2) AND (r6c7 = 5) AND (r7c1 = 2) AND (r7c2 = 3) AND (r7c6 = 4) AND (r7c9 = 9) AND (r8c1 = 4) AND (r8c4 = 7) AND (r8c5 = 6) AND (r8c9 = 5) AND (r9c1 = 5) AND (r9c5 = 3) AND (r9c6 = 9) AND (r9c8 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 6) AND (r1c4 = 8) AND (r1c6 = 9) AND (r1c9 = 5) AND (r2c1 = 5) AND (r2c6 = 4) AND (r3c1 = 9) AND (r3c2 = 2) AND (r3c7 = 6) AND (r4c3 = 1) AND (r4c7 = 3) AND (r5c3 = 3) AND (r5c5 = 8) AND (r5c9 = 6) AND (r6c1 = 6) AND (r6c4 = 1) AND (r6c5 = 9) AND (r6c8 = 5) AND (r6c9 = 8) AND (r7c9 = 3) AND (r8c6 = 2) AND (r9c4 = 6) AND (r9c7 = 1) AND (r9c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c7 = 6) AND (r1c9 = 7) AND (r2c4 = 7) AND (r2c5 = 9) AND (r2c8 = 8) AND (r2c9 = 3) AND (r3c5 = 8) AND (r3c7 = 5) AND (r3c8 = 4) AND (r4c2 = 4) AND (r4c3 = 3) AND (r4c5 = 1) AND (r4c9 = 5) AND (r5c3 = 5) AND (r5c8 = 6) AND (r6c2 = 6) AND (r6c5 = 3) AND (r6c7 = 4) AND (r7c1 = 6) AND (r7c4 = 3) AND (r7c6 = 9) AND (r7c7 = 8) AND (r8c6 = 5) AND (r8c8 = 9) AND (r9c1 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c6 = 2) AND (r2c2 = 4) AND (r2c6 = 6) AND (r2c8 = 7) AND (r2c9 = 1) AND (r3c3 = 9) AND (r3c4 = 3) AND (r3c7 = 4) AND (r4c4 = 9) AND (r4c5 = 4) AND (r5c3 = 6) AND (r5c6 = 1) AND (r5c9 = 7) AND (r6c3 = 1) AND (r6c5 = 2) AND (r6c6 = 7) AND (r7c1 = 7) AND (r7c3 = 4) AND (r7c4 = 1) AND (r7c5 = 6) AND (r7c8 = 9) AND (r7c9 = 5) AND (r8c1 = 9) AND (r9c1 = 6) AND (r9c2 = 1) AND (r9c5 = 5) AND (r9c8 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 7) AND (r1c6 = 1) AND (r1c8 = 4) AND (r2c1 = 8) AND (r2c3 = 9) AND (r2c4 = 2) AND (r2c8 = 1) AND (r3c4 = 8) AND (r3c6 = 7) AND (r3c7 = 2) AND (r3c9 = 5) AND (r4c1 = 5) AND (r5c3 = 4) AND (r5c4 = 6) AND (r5c8 = 8) AND (r6c3 = 7) AND (r6c4 = 4) AND (r7c4 = 9) AND (r7c8 = 6) AND (r7c9 = 8) AND (r8c1 = 9) AND (r8c3 = 5) AND (r8c4 = 1) AND (r8c6 = 8) AND (r8c7 = 4) AND (r8c8 = 7) AND (r9c1 = 4) AND (r9c3 = 8) AND (r9c5 = 2) AND (r9c8 = 5) AND (r9c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 7) AND (r1c3 = 8) AND (r1c9 = 4) AND (r2c1 = 6) AND (r2c3 = 2) AND (r2c7 = 5) AND (r2c8 = 8) AND (r3c1 = 5) AND (r3c2 = 4) AND (r3c5 = 2) AND (r3c7 = 1) AND (r3c8 = 6) AND (r3c9 = 7) AND (r4c7 = 8) AND (r4c8 = 4) AND (r5c1 = 2) AND (r5c7 = 7) AND (r5c9 = 5) AND (r6c1 = 4) AND (r6c2 = 8) AND (r6c3 = 5) AND (r6c6 = 1) AND (r6c8 = 2) AND (r7c1 = 7) AND (r7c4 = 3) AND (r7c6 = 4) AND (r8c9 = 2) AND (r9c1 = 8) AND (r9c2 = 5) AND (r9c6 = 6) AND (r9c7 = 4) AND (r9c8 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 5) AND (r1c9 = 3) AND (r2c3 = 6) AND (r2c6 = 1) AND (r2c8 = 8) AND (r3c4 = 4) AND (r3c7 = 6) AND (r3c9 = 2) AND (r4c9 = 1) AND (r5c4 = 9) AND (r5c6 = 8) AND (r5c7 = 5) AND (r6c5 = 3) AND (r6c6 = 6) AND (r6c7 = 8) AND (r7c1 = 4) AND (r7c7 = 1) AND (r7c8 = 9) AND (r8c1 = 8) AND (r8c3 = 5) AND (r8c5 = 1) AND (r8c8 = 4) AND (r9c4 = 6) AND (r9c6 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 9) AND (r1c5 = 3) AND (r2c3 = 6) AND (r2c4 = 2) AND (r2c6 = 8) AND (r3c4 = 9) AND (r3c5 = 7) AND (r3c9 = 5) AND (r5c1 = 2) AND (r5c3 = 9) AND (r5c4 = 8) AND (r5c6 = 3) AND (r6c4 = 6) AND (r6c6 = 7) AND (r6c9 = 9) AND (r7c1 = 7) AND (r7c2 = 5) AND (r7c8 = 8) AND (r7c9 = 4) AND (r8c2 = 4) AND (r8c3 = 8) AND (r8c5 = 5) AND (r8c7 = 6) AND (r8c9 = 3) AND (r9c3 = 2) AND (r9c8 = 5) AND (r9c9 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 1) AND (r1c5 = 2) AND (r2c4 = 1) AND (r2c9 = 8) AND (r3c2 = 8) AND (r3c4 = 3) AND (r3c6 = 7) AND (r3c8 = 1) AND (r4c2 = 5) AND (r4c3 = 7) AND (r4c8 = 3) AND (r5c3 = 2) AND (r5c7 = 6) AND (r6c1 = 8) AND (r6c7 = 5) AND (r6c8 = 7) AND (r6c9 = 4) AND (r7c2 = 7) AND (r7c9 = 3) AND (r8c3 = 4) AND (r8c4 = 7) AND (r8c7 = 1) AND (r8c8 = 2) AND (r9c1 = 2) AND (r9c3 = 5) AND (r9c7 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c2 = 1) AND (r1c6 = 3) AND (r1c7 = 9) AND (r2c2 = 6) AND (r2c8 = 8) AND (r2c9 = 2) AND (r3c1 = 2) AND (r3c4 = 7) AND (r3c7 = 3) AND (r4c2 = 8) AND (r4c5 = 3) AND (r4c6 = 6) AND (r5c2 = 9) AND (r5c5 = 1) AND (r5c7 = 4) AND (r5c8 = 3) AND (r6c3 = 6) AND (r6c6 = 9) AND (r7c3 = 2) AND (r8c5 = 8) AND (r8c8 = 7) AND (r9c9 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 7) AND (r1c5 = 8) AND (r1c7 = 4) AND (r2c1 = 3) AND (r2c9 = 2) AND (r4c1 = 1) AND (r4c3 = 6) AND (r4c4 = 3) AND (r5c7 = 8) AND (r5c8 = 5) AND (r6c1 = 2) AND (r7c2 = 8) AND (r7c3 = 4) AND (r7c8 = 3) AND (r8c4 = 2) AND (r8c6 = 1) AND (r9c5 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 4) AND (r1c3 = 9) AND (r2c6 = 7) AND (r3c2 = 6) AND (r3c7 = 4) AND (r4c1 = 9) AND (r4c2 = 1) AND (r4c4 = 7) AND (r4c8 = 3) AND (r4c9 = 6) AND (r5c4 = 3) AND (r5c5 = 5) AND (r5c7 = 1) AND (r5c8 = 4) AND (r6c1 = 2) AND (r7c4 = 5) AND (r7c8 = 7) AND (r8c2 = 3) AND (r8c3 = 6) AND (r8c5 = 2) AND (r9c2 = 2) AND (r9c4 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c5 = 5) AND (r1c8 = 4) AND (r1c9 = 6) AND (r2c6 = 1) AND (r2c8 = 7) AND (r3c1 = 3) AND (r3c3 = 6) AND (r3c6 = 9) AND (r3c7 = 5) AND (r3c9 = 1) AND (r4c2 = 5) AND (r4c5 = 9) AND (r4c6 = 4) AND (r5c4 = 2) AND (r6c1 = 9) AND (r6c5 = 7) AND (r6c9 = 3) AND (r7c1 = 4) AND (r7c5 = 6) AND (r7c6 = 7) AND (r7c8 = 2) AND (r7c9 = 5) AND (r9c1 = 6) AND (r9c4 = 5) AND (r9c5 = 1) AND (r9c6 = 3) AND (r9c9 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 7) AND (r1c4 = 2) AND (r1c6 = 4) AND (r1c8 = 1) AND (r2c1 = 4) AND (r2c2 = 9) AND (r2c4 = 1) AND (r2c6 = 7) AND (r2c8 = 5) AND (r2c9 = 2) AND (r3c5 = 5) AND (r4c1 = 1) AND (r4c2 = 3) AND (r4c8 = 9) AND (r4c9 = 7) AND (r5c3 = 9) AND (r5c7 = 2) AND (r6c1 = 5) AND (r6c2 = 4) AND (r6c8 = 6) AND (r6c9 = 3) AND (r7c5 = 2) AND (r8c1 = 2) AND (r8c2 = 5) AND (r8c4 = 7) AND (r8c6 = 1) AND (r8c8 = 8) AND (r8c9 = 6) AND (r9c2 = 1) AND (r9c4 = 6) AND (r9c6 = 3) AND (r9c8 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 5) AND (r1c6 = 2) AND (r1c9 = 4) AND (r2c1 = 7) AND (r2c3 = 2) AND (r2c6 = 4) AND (r2c7 = 3) AND (r2c8 = 5) AND (r3c2 = 1) AND (r3c6 = 3) AND (r3c7 = 9) AND (r4c1 = 3) AND (r4c3 = 7) AND (r4c4 = 5) AND (r4c6 = 8) AND (r4c7 = 2) AND (r6c7 = 7) AND (r6c9 = 8) AND (r7c2 = 7) AND (r7c3 = 1) AND (r7c5 = 8) AND (r7c6 = 5) AND (r7c7 = 4) AND (r8c1 = 4) AND (r8c3 = 3) AND (r8c9 = 2) AND (r9c1 = 2) AND (r9c3 = 8) AND (r9c5 = 3) AND (r9c9 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c8 = 1) AND (r2c6 = 2) AND (r2c8 = 3) AND (r2c9 = 4) AND (r3c3 = 2) AND (r3c5 = 5) AND (r4c4 = 4) AND (r4c8 = 6) AND (r5c3 = 7) AND (r5c7 = 8) AND (r6c2 = 5) AND (r7c5 = 7) AND (r7c7 = 5) AND (r8c1 = 9) AND (r8c2 = 4) AND (r8c4 = 1) AND (r9c2 = 6) AND (r9c9 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c9 = 1) AND (r2c6 = 4) AND (r2c8 = 8) AND (r3c2 = 4) AND (r3c4 = 6) AND (r3c6 = 1) AND (r3c8 = 2) AND (r4c1 = 5) AND (r4c2 = 6) AND (r4c3 = 2) AND (r4c5 = 7) AND (r4c7 = 3) AND (r4c8 = 4) AND (r5c1 = 1) AND (r5c3 = 7) AND (r5c6 = 3) AND (r5c9 = 2) AND (r6c1 = 4) AND (r6c2 = 3) AND (r6c5 = 6) AND (r6c8 = 7) AND (r7c9 = 7) AND (r8c6 = 6) AND (r8c7 = 8) AND (r8c9 = 4) AND (r9c1 = 3) AND (r9c4 = 8) AND (r9c6 = 7) AND (r9c7 = 2) AND (r9c8 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c6 = 3) AND (r2c1 = 7) AND (r2c7 = 8) AND (r2c8 = 5) AND (r3c2 = 8) AND (r3c4 = 4) AND (r3c5 = 9) AND (r3c8 = 7) AND (r4c3 = 4) AND (r5c2 = 3) AND (r5c4 = 1) AND (r5c5 = 8) AND (r6c1 = 6) AND (r6c3 = 9) AND (r6c9 = 4) AND (r8c3 = 6) AND (r8c5 = 5) AND (r8c9 = 3) AND (r9c5 = 6) AND (r9c9 = 1);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 9) AND (r1c6 = 4) AND (r1c8 = 8) AND (r1c9 = 6) AND (r2c3 = 6) AND (r2c4 = 3) AND (r2c7 = 7) AND (r3c2 = 4) AND (r3c3 = 8) AND (r3c8 = 3) AND (r3c9 = 5) AND (r4c2 = 9) AND (r4c4 = 4) AND (r5c3 = 1) AND (r6c1 = 4) AND (r6c3 = 5) AND (r6c4 = 9) AND (r6c6 = 6) AND (r7c1 = 7) AND (r7c2 = 8) AND (r7c3 = 4) AND (r7c5 = 6) AND (r7c6 = 9) AND (r7c9 = 3) AND (r8c6 = 3) AND (r9c1 = 6) AND (r9c4 = 1) AND (r9c5 = 4) AND (r9c6 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 5) AND (r1c4 = 9) AND (r1c7 = 1) AND (r2c4 = 4) AND (r2c7 = 9) AND (r3c1 = 6) AND (r3c2 = 3) AND (r3c5 = 2) AND (r3c7 = 5) AND (r4c1 = 4) AND (r4c9 = 6) AND (r5c3 = 1) AND (r5c5 = 3) AND (r6c8 = 3) AND (r6c9 = 4) AND (r7c1 = 7) AND (r7c2 = 2) AND (r7c4 = 6) AND (r8c4 = 7) AND (r9c8 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 2) AND (r1c5 = 1) AND (r1c7 = 4) AND (r2c3 = 3) AND (r2c5 = 9) AND (r2c7 = 2) AND (r2c8 = 5) AND (r3c1 = 7) AND (r3c3 = 5) AND (r4c4 = 9) AND (r4c7 = 6) AND (r4c9 = 3) AND (r5c1 = 9) AND (r6c3 = 2) AND (r6c6 = 5) AND (r7c5 = 2) AND (r7c8 = 4) AND (r8c6 = 9) AND (r8c8 = 2) AND (r8c9 = 7) AND (r9c3 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 3) AND (r1c6 = 5) AND (r2c1 = 4) AND (r2c4 = 8) AND (r2c5 = 6) AND (r2c6 = 9) AND (r2c9 = 5) AND (r3c1 = 8) AND (r4c3 = 9) AND (r4c6 = 2) AND (r4c8 = 5) AND (r4c9 = 6) AND (r5c1 = 1) AND (r5c3 = 2) AND (r5c8 = 3) AND (r6c1 = 6) AND (r6c2 = 8) AND (r6c4 = 9) AND (r6c5 = 3) AND (r6c8 = 2) AND (r6c9 = 4) AND (r7c2 = 3) AND (r7c3 = 8) AND (r7c4 = 6) AND (r7c9 = 9) AND (r8c1 = 5) AND (r9c3 = 6) AND (r9c9 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 7) AND (r1c9 = 1) AND (r2c3 = 2) AND (r2c4 = 9) AND (r2c8 = 5) AND (r3c1 = 8) AND (r3c7 = 4) AND (r4c3 = 6) AND (r4c4 = 2) AND (r4c5 = 5) AND (r5c6 = 7) AND (r6c4 = 3) AND (r6c6 = 6) AND (r6c8 = 9) AND (r7c1 = 4) AND (r7c7 = 7) AND (r8c2 = 1) AND (r8c9 = 8) AND (r9c3 = 5) AND (r9c5 = 3) AND (r9c8 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 3) AND (r1c4 = 5) AND (r1c8 = 8) AND (r2c1 = 7) AND (r2c5 = 2) AND (r3c3 = 9) AND (r3c6 = 7) AND (r4c4 = 2) AND (r4c6 = 1) AND (r5c1 = 5) AND (r5c2 = 2) AND (r6c2 = 4) AND (r6c5 = 8) AND (r6c7 = 7) AND (r7c4 = 3) AND (r7c8 = 2) AND (r8c5 = 9) AND (r8c6 = 8) AND (r8c7 = 3) AND (r9c2 = 1) AND (r9c3 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c2 = 1) AND (r1c3 = 2) AND (r1c5 = 3) AND (r2c1 = 4) AND (r2c7 = 5) AND (r3c4 = 7) AND (r3c7 = 2) AND (r3c8 = 3) AND (r4c1 = 2) AND (r4c4 = 8) AND (r4c5 = 5) AND (r5c1 = 3) AND (r5c4 = 1) AND (r5c5 = 6) AND (r5c6 = 7) AND (r5c7 = 8) AND (r5c9 = 5) AND (r6c4 = 4) AND (r6c8 = 7) AND (r6c9 = 6) AND (r7c1 = 1) AND (r7c5 = 7) AND (r8c2 = 6) AND (r8c3 = 5) AND (r8c9 = 8) AND (r9c9 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c7 = 8) AND (r2c1 = 2) AND (r2c2 = 8) AND (r2c3 = 3) AND (r2c7 = 4) AND (r2c8 = 1) AND (r3c4 = 2) AND (r4c3 = 1) AND (r4c4 = 3) AND (r4c9 = 6) AND (r5c3 = 2) AND (r5c4 = 1) AND (r5c6 = 6) AND (r5c8 = 5) AND (r5c9 = 4) AND (r6c6 = 5) AND (r6c8 = 7) AND (r7c1 = 1) AND (r7c3 = 5) AND (r8c4 = 4) AND (r8c8 = 3) AND (r8c9 = 1) AND (r9c1 = 3) AND (r9c3 = 8) AND (r9c6 = 1) AND (r9c7 = 6) AND (r9c8 = 2) AND (r9c9 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c6 = 5) AND (r1c9 = 1) AND (r2c2 = 6) AND (r2c5 = 7) AND (r2c7 = 2) AND (r3c2 = 1) AND (r3c3 = 7) AND (r4c3 = 3) AND (r4c4 = 5) AND (r4c5 = 2) AND (r5c4 = 8) AND (r5c5 = 3) AND (r5c7 = 1) AND (r5c9 = 4) AND (r7c4 = 7) AND (r7c9 = 5) AND (r8c3 = 2) AND (r8c6 = 1) AND (r8c9 = 3) AND (r9c1 = 3) AND (r9c2 = 4) AND (r9c9 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 7) AND (r1c4 = 5) AND (r1c6 = 8) AND (r1c8 = 6) AND (r2c1 = 8) AND (r2c5 = 1) AND (r2c9 = 7) AND (r3c2 = 9) AND (r3c8 = 8) AND (r4c3 = 8) AND (r4c4 = 6) AND (r4c6 = 9) AND (r4c7 = 7) AND (r5c2 = 5) AND (r5c3 = 9) AND (r5c4 = 2) AND (r5c6 = 7) AND (r5c7 = 8) AND (r5c8 = 1) AND (r6c3 = 7) AND (r6c4 = 1) AND (r6c6 = 3) AND (r6c7 = 5) AND (r7c2 = 3) AND (r7c8 = 4) AND (r8c1 = 7) AND (r8c5 = 6) AND (r8c9 = 2) AND (r9c2 = 6) AND (r9c4 = 8) AND (r9c6 = 4) AND (r9c8 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 8) AND (r1c7 = 7) AND (r1c8 = 4) AND (r2c1 = 5) AND (r2c3 = 1) AND (r3c1 = 3) AND (r3c8 = 9) AND (r4c2 = 9) AND (r4c4 = 2) AND (r4c7 = 5) AND (r5c4 = 6) AND (r5c5 = 8) AND (r6c7 = 3) AND (r7c5 = 3) AND (r7c6 = 1) AND (r8c2 = 2) AND (r8c9 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 3) AND (r1c7 = 5) AND (r1c9 = 9) AND (r2c1 = 9) AND (r2c2 = 8) AND (r2c3 = 6) AND (r2c5 = 2) AND (r2c7 = 3) AND (r3c3 = 2) AND (r3c9 = 1) AND (r4c7 = 1) AND (r4c8 = 7) AND (r5c4 = 5) AND (r5c6 = 7) AND (r7c1 = 7) AND (r7c6 = 3) AND (r7c7 = 8) AND (r7c8 = 6) AND (r8c3 = 8) AND (r8c4 = 2) AND (r8c5 = 6) AND (r9c2 = 5) AND (r9c9 = 3);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 4) AND (r1c9 = 3) AND (r2c2 = 2) AND (r2c5 = 5) AND (r2c9 = 9) AND (r3c2 = 9) AND (r3c3 = 5) AND (r3c5 = 3) AND (r3c8 = 8) AND (r4c4 = 4) AND (r6c1 = 6) AND (r6c6 = 9) AND (r6c7 = 7) AND (r7c1 = 4) AND (r7c4 = 7) AND (r7c7 = 6) AND (r7c8 = 2) AND (r8c4 = 6) AND (r8c9 = 5) AND (r9c1 = 3) AND (r9c4 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 9) AND (r2c5 = 6) AND (r2c8 = 1) AND (r3c6 = 5) AND (r4c2 = 1) AND (r4c6 = 9) AND (r5c1 = 8) AND (r5c5 = 4) AND (r6c1 = 4) AND (r6c2 = 2) AND (r6c4 = 8) AND (r6c8 = 3) AND (r7c4 = 9) AND (r7c7 = 5) AND (r7c9 = 3) AND (r8c2 = 8) AND (r8c3 = 5) AND (r8c4 = 3) AND (r8c9 = 1) AND (r9c4 = 1) AND (r9c6 = 2) AND (r9c8 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c8 = 1) AND (r2c1 = 3) AND (r2c2 = 2) AND (r2c4 = 9) AND (r2c9 = 5) AND (r3c2 = 8) AND (r3c4 = 4) AND (r3c5 = 5) AND (r4c3 = 2) AND (r4c4 = 5) AND (r4c6 = 3) AND (r5c8 = 5) AND (r5c9 = 9) AND (r6c1 = 7) AND (r6c9 = 3) AND (r7c3 = 7) AND (r8c1 = 5) AND (r8c5 = 4) AND (r8c7 = 1) AND (r9c2 = 9) AND (r9c3 = 1) AND (r9c4 = 3) AND (r9c7 = 5) AND (r9c8 = 2) AND (r9c9 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c4 = 5) AND (r1c8 = 4) AND (r2c1 = 5) AND (r2c4 = 3) AND (r2c6 = 8) AND (r3c1 = 2) AND (r3c7 = 9) AND (r4c2 = 6) AND (r4c5 = 7) AND (r5c1 = 4) AND (r5c2 = 3) AND (r5c7 = 6) AND (r6c3 = 5) AND (r6c5 = 8) AND (r7c3 = 9) AND (r7c9 = 6) AND (r8c1 = 7) AND (r8c7 = 5) AND (r9c2 = 8) AND (r9c4 = 4) AND (r9c6 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 9) AND (r1c4 = 3) AND (r1c6 = 5) AND (r1c7 = 7) AND (r2c2 = 3) AND (r2c4 = 8) AND (r2c9 = 2) AND (r3c3 = 8) AND (r3c5 = 2) AND (r3c7 = 6) AND (r4c3 = 2) AND (r4c8 = 9) AND (r4c9 = 7) AND (r5c2 = 7) AND (r5c3 = 6) AND (r5c5 = 5) AND (r5c7 = 1) AND (r6c2 = 8) AND (r6c7 = 3) AND (r7c4 = 9) AND (r7c9 = 1) AND (r8c6 = 1) AND (r9c8 = 6);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 1) AND (r1c6 = 6) AND (r1c9 = 7) AND (r2c2 = 2) AND (r2c4 = 5) AND (r2c7 = 8) AND (r3c3 = 9) AND (r3c4 = 7) AND (r3c9 = 6) AND (r4c1 = 7) AND (r4c3 = 5) AND (r5c3 = 1) AND (r5c5 = 3) AND (r5c7 = 2) AND (r5c8 = 9) AND (r7c5 = 9) AND (r7c6 = 5) AND (r8c1 = 2) AND (r8c9 = 3) AND (r9c1 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 2) AND (r1c2 = 9) AND (r1c4 = 1) AND (r1c5 = 4) AND (r2c5 = 5) AND (r2c6 = 8) AND (r3c1 = 1) AND (r3c2 = 8) AND (r3c5 = 6) AND (r3c7 = 5) AND (r4c1 = 8) AND (r4c9 = 2) AND (r5c2 = 1) AND (r5c4 = 7) AND (r5c9 = 6) AND (r6c7 = 7) AND (r6c8 = 9) AND (r7c1 = 4) AND (r7c7 = 2) AND (r7c8 = 1) AND (r8c9 = 9) AND (r9c1 = 7) AND (r9c4 = 2) AND (r9c7 = 4) AND (r9c9 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 6) AND (r1c3 = 1) AND (r1c5 = 9) AND (r3c1 = 9) AND (r3c3 = 7) AND (r3c5 = 4) AND (r3c8 = 6) AND (r4c3 = 8) AND (r4c8 = 4) AND (r5c1 = 7) AND (r5c2 = 3) AND (r5c3 = 2) AND (r5c8 = 9) AND (r6c1 = 1) AND (r6c8 = 7) AND (r7c2 = 8) AND (r7c3 = 4) AND (r7c4 = 6) AND (r7c5 = 1) AND (r7c9 = 9) AND (r8c1 = 2) AND (r8c3 = 9) AND (r8c5 = 8) AND (r8c6 = 4) AND (r8c7 = 3) AND (r9c5 = 2) AND (r9c6 = 7) AND (r9c8 = 8) AND (r9c9 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 4) AND (r1c6 = 1) AND (r1c8 = 2) AND (r2c8 = 3) AND (r2c9 = 4) AND (r3c3 = 5) AND (r3c5 = 6) AND (r4c4 = 3) AND (r4c9 = 7) AND (r5c3 = 1) AND (r5c7 = 6) AND (r6c1 = 6) AND (r6c6 = 2) AND (r7c5 = 4) AND (r7c7 = 1) AND (r8c1 = 9) AND (r8c2 = 7) AND (r9c2 = 3) AND (r9c4 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c2 = 9) AND (r2c1 = 3) AND (r2c3 = 6) AND (r2c5 = 4) AND (r3c2 = 1) AND (r3c3 = 4) AND (r4c2 = 7) AND (r4c9 = 1) AND (r5c3 = 1) AND (r5c5 = 6) AND (r6c1 = 2) AND (r6c6 = 7) AND (r6c7 = 9) AND (r6c9 = 8) AND (r7c1 = 7) AND (r7c4 = 6) AND (r7c5 = 2) AND (r7c6 = 1) AND (r7c7 = 8) AND (r7c9 = 3) AND (r8c4 = 7) AND (r8c6 = 3) AND (r8c7 = 4) AND (r8c8 = 9) AND (r9c2 = 3) AND (r9c5 = 8) AND (r9c6 = 9) AND (r9c8 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 4) AND (r2c2 = 4) AND (r2c5 = 7) AND (r2c8 = 3) AND (r2c9 = 6) AND (r3c1 = 2) AND (r3c5 = 3) AND (r3c6 = 6) AND (r3c8 = 8) AND (r4c4 = 1) AND (r4c5 = 4) AND (r4c9 = 7) AND (r5c1 = 1) AND (r5c6 = 3) AND (r5c8 = 6) AND (r6c4 = 6) AND (r6c8 = 2) AND (r7c1 = 3) AND (r7c5 = 5) AND (r7c8 = 1) AND (r8c2 = 5) AND (r8c4 = 7) AND (r8c5 = 8) AND (r8c6 = 2) AND (r9c9 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c8 = 1) AND (r2c6 = 2) AND (r2c8 = 3) AND (r2c9 = 4) AND (r3c3 = 5) AND (r3c5 = 6) AND (r4c4 = 4) AND (r4c8 = 7) AND (r5c3 = 2) AND (r5c7 = 6) AND (r6c2 = 1) AND (r6c6 = 5) AND (r7c5 = 8) AND (r7c7 = 2) AND (r8c1 = 7) AND (r8c2 = 3) AND (r8c4 = 1) AND (r9c2 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 8) AND (r1c4 = 4) AND (r1c5 = 3) AND (r1c7 = 9) AND (r1c8 = 1) AND (r2c1 = 3) AND (r2c5 = 9) AND (r3c2 = 4) AND (r3c4 = 7) AND (r3c6 = 1) AND (r3c9 = 6) AND (r4c2 = 7) AND (r4c4 = 1) AND (r4c5 = 4) AND (r4c7 = 5) AND (r5c1 = 6) AND (r5c3 = 3) AND (r6c1 = 5) AND (r6c2 = 1) AND (r6c8 = 8) AND (r7c1 = 7) AND (r7c3 = 6) AND (r7c4 = 8) AND (r7c8 = 9) AND (r8c2 = 3) AND (r8c4 = 9) AND (r9c2 = 9) AND (r9c4 = 3) AND (r9c9 = 8);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 7) AND (r1c3 = 1) AND (r1c4 = 2) AND (r1c5 = 5) AND (r1c8 = 8) AND (r2c1 = 8) AND (r2c3 = 6) AND (r2c5 = 7) AND (r2c6 = 4) AND (r2c9 = 5) AND (r3c2 = 9) AND (r3c3 = 4) AND (r3c6 = 6) AND (r3c7 = 7) AND (r5c3 = 8) AND (r5c4 = 6) AND (r5c6 = 5) AND (r5c9 = 9) AND (r6c4 = 8) AND (r6c5 = 2) AND (r6c6 = 1) AND (r6c8 = 4) AND (r6c9 = 6) AND (r7c1 = 6) AND (r7c6 = 8) AND (r7c9 = 1) AND (r8c1 = 1) AND (r8c3 = 9) AND (r8c9 = 7) AND (r9c2 = 4);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 1) AND (r1c5 = 5) AND (r1c7 = 6) AND (r2c1 = 8) AND (r2c3 = 7) AND (r3c1 = 3) AND (r4c4 = 7) AND (r4c6 = 8) AND (r4c8 = 3) AND (r5c2 = 1) AND (r5c7 = 4) AND (r7c2 = 4) AND (r7c5 = 6) AND (r7c7 = 2) AND (r8c1 = 5) AND (r8c8 = 8) AND (r9c4 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 7) AND (r1c5 = 9) AND (r1c7 = 2) AND (r2c3 = 6) AND (r2c7 = 3) AND (r2c9 = 8) AND (r3c2 = 5) AND (r3c5 = 8) AND (r3c6 = 3) AND (r3c8 = 7) AND (r3c9 = 9) AND (r4c3 = 4) AND (r4c4 = 3) AND (r4c7 = 7) AND (r4c8 = 6) AND (r5c7 = 8) AND (r5c9 = 2) AND (r6c1 = 5) AND (r6c2 = 6) AND (r8c2 = 8) AND (r8c3 = 9) AND (r8c4 = 5) AND (r8c6 = 6) AND (r9c1 = 3) AND (r9c2 = 2) AND (r9c9 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c3 = 2) AND (r1c4 = 8) AND (r1c6 = 1) AND (r1c7 = 5) AND (r1c8 = 4) AND (r2c5 = 3) AND (r3c4 = 4) AND (r3c5 = 6) AND (r3c6 = 5) AND (r4c1 = 8) AND (r4c3 = 3) AND (r4c6 = 9) AND (r4c7 = 4) AND (r4c9 = 5) AND (r5c2 = 5) AND (r5c6 = 3) AND (r5c9 = 1) AND (r6c3 = 6) AND (r6c7 = 3) AND (r7c4 = 2) AND (r7c6 = 4) AND (r8c3 = 5) AND (r8c5 = 1) AND (r8c6 = 8) AND (r8c7 = 6) AND (r8c8 = 2) AND (r9c3 = 9) AND (r9c5 = 5);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c4 = 1) AND (r2c1 = 1) AND (r2c2 = 2) AND (r2c5 = 9) AND (r2c8 = 7) AND (r3c5 = 7) AND (r3c6 = 6) AND (r5c2 = 6) AND (r5c5 = 3) AND (r5c6 = 9) AND (r5c8 = 1) AND (r6c1 = 5) AND (r6c3 = 9) AND (r6c4 = 4) AND (r6c6 = 7) AND (r6c8 = 2) AND (r7c3 = 2) AND (r7c6 = 3) AND (r7c7 = 4) AND (r7c8 = 5) AND (r8c1 = 6) AND (r8c4 = 7) AND (r8c5 = 2) AND (r8c8 = 3) AND (r8c9 = 9) AND (r9c2 = 7) AND (r9c4 = 9) AND (r9c5 = 4) AND (r9c6 = 1) AND (r9c8 = 6) AND (r9c9 = 2);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 2) AND (r2c3 = 5) AND (r2c5 = 3) AND (r2c6 = 9) AND (r2c7 = 8) AND (r3c1 = 8) AND (r3c2 = 4) AND (r3c3 = 9) AND (r3c5 = 7) AND (r4c3 = 7) AND (r4c4 = 3) AND (r4c5 = 2) AND (r4c6 = 6) AND (r5c4 = 7) AND (r5c5 = 4) AND (r5c6 = 8) AND (r5c9 = 3) AND (r6c6 = 5) AND (r7c3 = 3) AND (r7c5 = 6) AND (r7c9 = 5) AND (r8c2 = 5) AND (r8c4 = 9) AND (r8c8 = 6) AND (r9c1 = 4) AND (r9c3 = 8) AND (r9c5 = 5) AND (r9c6 = 7) AND (r9c8 = 3) AND (r9c9 = 9);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 1) AND (r1c2 = 9) AND (r2c1 = 8) AND (r2c5 = 7) AND (r2c8 = 1) AND (r2c9 = 6) AND (r3c2 = 7) AND (r3c4 = 2) AND (r3c7 = 5) AND (r3c9 = 3) AND (r4c8 = 2) AND (r4c9 = 7) AND (r5c2 = 3) AND (r5c9 = 8) AND (r6c1 = 9) AND (r6c3 = 5) AND (r7c2 = 1) AND (r7c3 = 8) AND (r7c6 = 2) AND (r7c8 = 3) AND (r8c9 = 2) AND (r9c2 = 6) AND (r9c5 = 1) AND (r9c8 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c1 = 8) AND (r1c3 = 5) AND (r1c9 = 2) AND (r2c4 = 9) AND (r2c6 = 1) AND (r3c1 = 3) AND (r4c2 = 6) AND (r4c4 = 7) AND (r4c7 = 4) AND (r5c1 = 2) AND (r5c5 = 5) AND (r6c8 = 6) AND (r7c4 = 3) AND (r7c5 = 8) AND (r8c2 = 1) AND (r8c7 = 9) AND (r9c2 = 4) AND (r9c8 = 7);
SELECT * FROM sudoku_memory_combined_view WHERE (r1c2 = 8) AND (r2c1 = 1) AND (r2c3 = 7) AND (r2c7 = 8) AND (r2c9 = 3) AND (r3c6 = 6) AND (r3c9 = 1) AND (r4c2 = 2) AND (r5c1 = 3) AND (r5c5 = 1) AND (r6c3 = 8) AND (r6c4 = 5) AND (r6c7 = 6) AND (r6c8 = 9) AND (r7c5 = 3) AND (r7c6 = 7) AND (r7c7 = 9) AND (r8c6 = 1) AND (r9c1 = 5) AND (r9c2 = 9);
UPDATE tests SET fin = NOW() WHERE fin IS NULL;
SELECT TO_SECONDS(fin) - TO_SECONDS(debut) FROM tests;

6. Gosser à la main!

Maintenant que nous avons un échantillon représentatif et significatif et tout ce qu’il nous faut pour mesurer, de façon répétable et facile, chacun des changements que nous voulons effectuer, nous sommes en mesure de vérifier l’impact de 2 variables importantes : optimizer_search_depth et join_buffer_size.

Tout d’abord, la variable optimizer_search_depth dont voici les différents résultats :

optimizer_search_depth_table

Il est clair que cette variable a un impact majeur.  Nous savons maintenant que la valeur optimale de cette variable (dans notre cas précis) est 1.

optimizer_search_depth

On serait tenté de croire que la variable join_buffer_size pourrait avoir un impact non négligeable mais ce n’est pas le cas ici.

join_buffer_size_table

Les différences de temps (hormis pour la valeur 2Mb) ne sont pas assez significatives pour indiquer une tendance.  Malgré tout, théoriquement, cette variable devrait avoir un impact.  Pour les biens de la cause, autant avoir plus de mémoire que moins pour cette variable!  Je vous recommande donc 128Mb (plus, dans notre cas, serait un gaspillage de mémoire).

join_buffer_size

Finalement, pour mettre en valeur la différence entre une solution utilisant une table sur disque versus notre solution finale (une table en mémoire), l’histogramme suivant parle de lui-même!

engine_type

Voilà!  CQFD. En espérant que cette série d’articles vous aura permis de constater que parfois, il est nécessaire de penser out of the box et d’envisager des solutions saugrenues pour arriver à ses fins.

7. Ressources et outils

Quelques-unes des ressources et des outils utilisés dans le cadre de cette série d’articles:

setbb.com : des forums de discussion sur le sudoku (en anglais) pour les programmeurs

enjoysudoku.com : des forums de discussions (en anglais) variés et nombreux sur les sudokus

QQWing : un outil (en ligne de commande) permettant de solutionner et de générer des grilles de sudoku

SudoCue : une application permettant de solutionner et générer des sudokus

Sudoku Explainer : une application permettant de solutionner et générer des sudokus

R : langage de programmation et environnement mathématique utilisé pour le traitement de données et l’analyse statistique

db4free.net : un serveur MySQL vous permettant de créer une base de donnée gratuitement et d’expérimenter

Pharo : un environnement de développement Smalltalk


VisualWorks 7.9.1

10 avril 2013

J’ai finalement pris le temps de télécharger VisualWorks 7.9.1 et de l’installer…  Mes premières impressions ?  Rien de significatif ni de très visible du côté des outils par rapport à la version 7.8, mais de subtils ajouts en préparation de la version 7.10.

De nombreux changements du côté de la machine virtuelle, dont le support 64 bits pour Windows, un garbage collector plus performant et l’abandon des plate-formes Linux/SPARC.

Côté GUI, quelques ajustements mineurs mais une foule d’ajouts en vue de la version 7.10.  Mais quelques petits changements irritants qui pourraient vous causer de désagréables surprises.

Par exemple, la classe ApplicationWindow n’est plus une sous-classe de ScheduledWindow mais bien un alias de celle-ci tel qu’expliqué ici!

Autre chose, la classe SubCanvas a subi quelques modifications.  Cette classe est maintenant obsolète et ses méthodes ont été rapatriées dans sa superclasse, CompositePart.  Effet collatéral: la variable d’instance « client » apparaît maintenant dans CompositePart et la méthode client a disparu!  Autre disparition, la méthode #clientSpecBuilder!  Plus de détails ici.

Quelques ajustements mineurs du côté des bases de données, le plus important étant le support 64 bits pour Oracle et ODBC ainsi que SQLite 3.  Du côté des curiosités concernant les requêtes SQL, il appert que les versions antérieures de VisualWorks permettaient, avec Oracle, de binder avant de faire un prepare : cela ne fait absolument aucun sens, mais il semble que certains se fiaient à VisualWorks et ses tours de magie pour compenser le fait que l’ordre des étapes nécessaires à l’exécution d’une requête SQL était inversé.  Bref, cela ne fonctionne plus sous 7.9 !  Comme il se doit, vous devez maintenant préparer puis binder puis exécuter!  Les détails sont ici.

Les plus nombreux ajouts et changements apportés par cette version sont regroupés au niveau des services web.  Il y en a tant qu’à cet égard, je vous suggère de lire la pléthore de changements et d’ajouts dans le document Release Notes à la section WebServices.

Outre les changements énumérés précédemment, il y a quelques détails au niveau de StORE qui ont été ajusté, de nouvelles implémentation au niveau des librairies de sécurité, etc.

Cela étant dit, ceux qui migreront vers cette version frapperont un mur au niveau de StORE.  Premier petit changement mineur, l’affichage des Bundles suit maintenant l’ordre alphabétique au lieu de l’ordre dans lequel ceux-ci devraient être chargés (considérant les prérequis de chacun).  Du côté des désagréables surprises, un sérieux problème de lenteur affecte la fonctionalité « browse versions » pour les méthodes dans la version officielle.  Heureusement, il existe déjà un correctif disponible (publié par Samuel S. Shuster sous le nom FastMethodVersions) sur le Cincom Public Repository!

Finalement, autre changement majeur concernant la méthode #@ (class Point).  Si vous créez un point avec la coordonnée y étant négative, vous aurez la surprise de découvrir que @- est maintenant un message valide!  Cela vous force donc maintenant à insérer un espace entre le @ et la coordonnée y négative!  Plus de détails ici.

Bref, la version 7.9.1 vaut amplement la peine d’une migration, d’autant plus que la version 7.10 introduira le nouveau framework SiouX pour les serveurs Web!