Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id D7C0C16D90F7 for ; Tue, 27 Mar 2012 10:20:01 -0300 (ADT) Received: from mail-qc0-f174.google.com ([209.85.216.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SCWJb-0000Nt-RN for pgsql-students@postgresql.org; Tue, 27 Mar 2012 13:20:01 +0000 Received: by qcqw6 with SMTP id w6so4007717qcq.19 for ; Tue, 27 Mar 2012 06:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=SCegqrdcIHTUPpwbK43/9wH+OUncM+Dks1/IFoWeVXc=; b=SE/YpGJ2qXoBOLL0wmPmt2WkEVSMG58bJ5q8KSk995RHw+LFAh6x1c0o7+suuDJ+sC gz7Yg9ZLyuDs72EYPAe8J7+lSWxKMnHeE+PCmz2rP8FNPhNa0mv3OUNqxQpA8WNUsDia l9AOtTTRZKTE4QdVRsEkrhNPUNGSptmYM265rmUt6Dt3AH1YwV3eVQtKTZyii8xwxQhO yyZRdpnx+NdJMValKQ05V8hJ3RlM8t6EbYnqHivJkoxvk8p1QJ3BVMr/153Isne1ZSgP C0bpjrMlj+K48VyhUcc+vKaC7HyZYzClGOc5d4cIgRy8cqv/MNwP7REV5Vc1gDZZ73Hj GrSw== MIME-Version: 1.0 Received: by 10.224.102.8 with SMTP id e8mr32561172qao.50.1332854387353; Tue, 27 Mar 2012 06:19:47 -0700 (PDT) Received: by 10.229.92.84 with HTTP; Tue, 27 Mar 2012 06:19:47 -0700 (PDT) In-Reply-To: References: Date: Tue, 27 Mar 2012 17:19:47 +0400 Message-ID: Subject: Re: GSoC 2012 From: Maxim Smyatkin To: Thom Brown , pgsql-students@postgresql.org Content-Type: multipart/alternative; boundary=20cf3074b0d84ba84a04bc3958bb X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201203/14 X-Sequence-Number: 218 --20cf3074b0d84ba84a04bc3958bb Content-Type: text/plain; charset=ISO-8859-1 Hello all, again. Finally, I have made a decision to work on Firebird FDW. I'm sorry for length of the letter, here is a list of content (if you wont read whole the message): 1. What I was doing during this time (from my first message to this one) and Why I finally decided to implement Firebird FDW? 2. What i want from Firebird FDW? 3. Specific questions I have to solve before proposing quantifiable results and schedule. 1. There is many interesting projects in TODO list, but I have not found any with which I am at least on 50% familiar as I am with Firebird's architecture or with Firebird's API, so I can't assure the completeness of such projects. Furthermore, I still remember how I was digging into internals of another projects and I am not as familiar with PostgreSQL that I have to be for doing something in its Core. So, I started looking for information about FDWs. I have done: 1) I got PostgreSQL source code and built it on Ubuntu. I opened project using Eclipse and I tried to debug forked postgresql process with client connected to it, to be sure that it works fine. 2) I used file_fdw as client, looked at its sources to get first impression about FDW internals and also tried to debug it, to be sure that I understand how to do it within Eclipse. 3) I have read client's and developer's documentation about FDWs; looked at FDW list on wiki (to choose something more complex than file_fdw to study and to estimate complexity of Firebird's one); Have read 2011 mail archive with FDW questions and looked at 2 presentations. 4) Tried to use mysql_fdw, but as I understood it uses old FDW API, so I downloaded Oracle_fdw to be familiar with modern API. Unfortunaly, Oracle-xe was not working on my Ubuntu (Probably, it works well, but I have to spend more time to set it up. May be I'll return to it, if it will be necessary). Anyway I was studying source code, readme and changelog and I found there several interesting optimizations, such as where push-down and connection pool (in library cache). At this moment my interest in Firebird FDW strongly grew up :) and I started to think about "quantifiable results". 2. Of course, I want Firebird FDW to be as good as Oracle's one is:) But, I cant be sure, that I'll complete it all in 3-4 month. So I have to choose most important of features to be implemented first. Next list contains features I want to implement marked as "+" for most important features and "?" for features I can implement later: + Types compatibility should be as full as it is possible to implement. + Translate most common Firebird SQL's and API's errors to PostgreSQL's analogues. + Plan and Cost output [3.1]. ? Connections pool optimization (as it is in Oracle). ? Predicates push-down (may be not only "where", to handle situations like it was described here: http://archives.postgresql.org/pgsql-students/2011-03/msg00036.php). ? Field compatibility (link fields not only on their position, but on type, name, and some other properties [3.2]). 3. Here is several (2 at this moment) questions I have to solve before cost estimation and schedule creation can be done: 1) Firebird shows very simple query plan without cardinality or selectivity values. Furthermore, it even does not maintain it internally (as I know it can be implemented in Firebird 3, but anyway I have to think about cost estimation depending on lack of statistics). So. probably, I have to get cardinality as Count(...) and then let PostgreSQL to estimate cost and selectivity based on heuristic rules. I'm pretty sure in positive answer, but "Can PostgreSQL do it?" 2) According to http://people.planetpostgresql.org/andrew/uploads/fdw2.pdfFKs, PKs, Constraints and defaults are not implemented because PostgreSQL can't manage them on foreign tables. NOT NULL is maintained because it can't be changed in foreign DBMS, so we can be sure in it (actually field can be recreated, so we can't be sure. Btw is it taken into account in Oracle FDW?), if I am right. But we can map all of these field properties from Firebird's metadata to PostgreSQL's (FK only between foreign tables, not between servers). To check it for every user's query is too high prise for such mapping, but (I am not sure about it, because we have something like read-only transactions) as Firebird implements multi-version transaction system - we can be sure that in context of one transaction this values cant be changed. And we can track it inside of connection pool. We can get several advantages from it: - It will be necessary if FDWs will be not read-only in future. - I think, PostgreSQL optimizer can make better decisions based on constraints sometimes? - And, finally, it can be useful for database user/client to know a character of data. -- Thank you! Smyatkin Maxim. --20cf3074b0d84ba84a04bc3958bb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello all, again.

Finally, I have made a decision to work on Firebir= d FDW. I'm sorry for length of the letter, here is a list of content (i= f you wont read whole the message):
1. What I was doing during this time= (from my first message to this one) and Why I finally decided to implement= Firebird FDW?
2. What i want from Firebird FDW?
3. Specific questions I have to solve = before proposing quantifiable results and schedule.

1. There is many= interesting projects in TODO list, but I have not found any with which I a= m at least on 50% familiar as I am with Firebird's architecture or with= Firebird's API, so I can't assure the completeness of such project= s. Furthermore, I still remember how I was digging into internals of anothe= r projects and I am not as familiar with PostgreSQL that I have to be for d= oing something in its Core. So, I started looking for information about FDW= s. I have done:
1) I got PostgreSQL source code and built it on Ubuntu. I opened project us= ing Eclipse and I tried to debug forked postgresql process with client conn= ected to it, to be sure that it works fine.
2) I used file_fdw as client= , looked at its sources to get first impression about FDW internals and als= o tried to debug it, to be sure that I understand how to do it within Eclip= se.
3) I have read client's and developer's documentation about FDWs; l= ooked at FDW list on wiki (to choose something more complex than file_fdw t= o study and to estimate complexity of Firebird's one); Have read 2011 m= ail archive with FDW questions and looked at 2 presentations.
4) Tried to use mysql_fdw, but as I understood it uses old FDW API, so I do= wnloaded Oracle_fdw to be familiar with modern API. Unfortunaly, Oracle-xe = was not working on my Ubuntu (Probably, it works well, but I have to spend = more time to set it up. May be I'll return to it, if it will be necessa= ry). Anyway I was studying source code, readme and changelog and I found th= ere several interesting optimizations, such as where push-down and connecti= on pool (in library cache). At this moment my interest in Firebird FDW stro= ngly grew up :) and I started to think about "quantifiable results&quo= t;.

2. Of course, I want Firebird FDW to be as good as Oracle's one is:= ) But, I cant be sure, that I'll complete it all in 3-4 month. So I hav= e to choose most important of features to be implemented first. Next list c= ontains features I want to implement marked as "+" for most impor= tant features and "?" for features I can implement later:
+ Types compatibility should be as full as it is possible to implement.
= + Translate most common Firebird SQL's and API's errors to PostgreS= QL's analogues.
+ Plan and Cost output [3.1].
? Connections pool = optimization (as it is in Oracle).
? Predicates push-down (may be not only "where", to handle situat= ions like it was described here: http://archives.postgresql.org/pgsql-s= tudents/2011-03/msg00036.php).
? Field compatibility (link fields not only on their position, but on type,= name, and some other properties [3.2]).

3. Here is several (2 at th= is moment) questions I have to solve before cost estimation and schedule cr= eation can be done:
1) Firebird shows very simple query plan without cardinality or selectivity= values. Furthermore, it even does not maintain it internally (as I know it= can be implemented in Firebird 3, but anyway I have to think about cost es= timation depending on lack of statistics). So. probably, I have to get card= inality as Count(...) and then let PostgreSQL to estimate cost and selectiv= ity based on heuristic rules. I'm pretty sure in positive answer, but &= quot;Can PostgreSQL do it?"
2) According to http://people.planetpostgresql.org/andrew/uploads/fdw2.pdf = FKs, PKs, Constraints and defaults are not implemented because PostgreSQL c= an't manage them on foreign tables. NOT NULL is maintained because it c= an't be changed in foreign DBMS, so we can be sure in it (actually fiel= d can be recreated, so we can't be sure. Btw is it taken into account i= n Oracle FDW?), if I am right. But we can map all of these field properties= from Firebird's metadata to PostgreSQL's (FK only between foreign = tables, not between servers). To check it for every user's query is too= high prise for such mapping, but (I am not sure about it, because we have = something like read-only transactions) as Firebird implements multi-version= transaction system - we can be sure that in context of one transaction thi= s values cant be changed. And we can track it inside of connection pool. We= can get several advantages from it:
- It will be necessary if FDWs will be not read-only in future.
- I thin= k, PostgreSQL optimizer can make better decisions based on constraints some= times?
- And, finally, it can be useful for database user/client to know= a character of data.


--
Thank you!
Smyatkin Maxim.

--20cf3074b0d84ba84a04bc3958bb--