from SICP lectures 8a & 8b.
While watching these, one thing that striked me is that this logic programming seems very similar to kind of things we use SQL for, just better... more flexible.
So why we do use SQL after all? after a bit of googling found this good article: http://search.cpan.org/dist/AI-Prolog/lib/AI/Prolog/Article.pod one of the references says:
So if prolog(read AI) and SQL(DB) are so similar, Why is one so successful commercially and the other deemed A complete failure in terms of scalability?
Databases implement powerful techniques to improve performance:
- Indexing
- Hashing
- reordering goals to reduce backtracking
Where as prolog based systems have very few such Techniques.
So does have SQL have everything needed?
One of the most powerful features of Prolog is recursion.
SQL does not have recursion built into it. This is a severe Handicap. However there is a way to overcome this problem by invoking multiple SQL queries from a host language like C
Or JAVA. SQL3 has begun supporting recursion.
1 comment:
Indeed, SQL is a brute machine when it comes to handling data-related expressions. The only thing that makes me use it from time to time is the performance we gain from the compilers (tons of man-hours have been dedicated into this effort over the last decades!). Anyway, either to prototype or simply to make my life easier, I never get my hands dirty on SQL - unless it is a requirement. Even having my root object serialized into a file is normally more appealing to me than dealing with a full blown DBMS controlled with SQL statements...
Post a Comment