From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Solving sudoku using SQL |
Date: | 2010-12-08 15:20:49 |
Message-ID: | AANLkTik1QTT3LN2oxZeWhVwaJ2gOb84CBEiLVJ3jDh8y@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Dec 8, 2010 at 8:57 AM, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
> Hi,
>
> I found an interesting article which explains how to solve "sudoku" by
> using SQL(unfortunately written in Japanese):
> http://codezine.jp/article/detail/1629?p=2
>
> In the article example sudoku is:
> http://static.shoeisha.jp/cz/static/images/article/1629/problem4.gif
>
> To solve the example you create following table:
>
> CREATE TABLE nums (n INT NOT NULL PRIMARY KEY);
> INSERT INTO nums VALUES (1);
> INSERT INTO nums VALUES (2);
> INSERT INTO nums VALUES (3);
> INSERT INTO nums VALUES (4);
> INSERT INTO nums VALUES (5);
> INSERT INTO nums VALUES (6);
> INSERT INTO nums VALUES (7);
> INSERT INTO nums VALUES (8);
> INSERT INTO nums VALUES (9);
>
> Then execute the huge SELECT:
> http://codezine.jp/static/images/article/1629/html/sql.html
>
> In the page first one takes infinite time by PostgreSQL 9.0.1. Next
> one can be executed very quickly because the join order is explicitely
> specified by cross join syntax. This seems to be a limitation of
> PostgreSQL optimizer and I would like it be removed. Comments?
>
> BTW according to the article, Oracle execute the first SELECT(the one
> PostgreSQL takes infinite time) in 10 seconds. It seems Oracle's
> optimizer is sperior in this regard.
benchmark what you've got against this (ported to postgres by marcin mank):
http://www.pastie.org/684163
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2010-12-08 15:22:59 | Re: Spread checkpoint sync |
Previous Message | Simon Riggs | 2010-12-08 15:19:07 | Re: unlogged tables |