This is one of the unqualified help-request i saw in this forum.
Help us help you!!! Upload a small project which shows the issue.
We do not know what result you got, we do not know what sql query you are using and what database is behin the query.
If the aboce code returns 25 ms then i guess it is OK. Querying the Database can be fast.
Help us giving us more details:
- What values do you get extacly? What values did you expected?
We only can fish
Could somebody check on their phone how long this query takes:
WITH RECURSIVE input(sud) AS (VALUES('53..7....6..1.5....98....6.8...6...34..8.3..17...2...6.6....2.....4.9..5....8..79')), digits(z, lp) AS (VALUES('1', 1) UNION ALL SELECT CAST(lp + 1 AS TEXT), lp + 1 FROM digits WHERE lp < 9), x(s, ind) AS (SELECT sud, instr(sud, '.') FROM input UNION ALL SELECT substr(s, 1, ind - 1) || z || substr(s, ind + 1), instr(substr(s, 1, ind - 1) || z || substr(s, ind + 1), '.') FROM x, digits AS z WHERE ind > 0 AND NOT EXISTS (SELECT 1 FROM digits AS lp WHERE z.z = substr(s, ((ind - 1) / 9) * 9 + lp, 1) OR z.z = substr(s, ((ind - 1) %9) + (lp - 1) * 9 + 1, 1) OR z.z = substr(s, (((ind - 1)/3) % 3) * 3 + ((ind - 1) / 27) * 27 + lp + ((lp - 1) / 3) * 6, 1))) SELECT s as solution FROM x WHERE ind = 0 order by s asc
RBS