1SQL::Statement::RoadmapU(s3e)r Contributed Perl DocumentaStQiLo:n:Statement::Roadmap(3)
2
3
4
6 SQL::Statement::Roadmap - Planned Enhancements for SQL::Statement and
7 SQL::Parser
8
9 Jens Rehsack - June 2010
10
12 This document gives a high level overview of the future of
13 SQL::Statement, SQL::Parser and its impact.
14
15 The planned enhancements cover testing, performance, reliability,
16 extensibility and more.
17
19 Enhancements in SQL::Statement 1.xx
20 SQL::Statement 1.xx will not receive big changes, but a few
21 enhancements may help us to design SQL::Statement 2.xx much better.
22
23 CREATE and DROP of FUNCTION, KEYWORD, OPERATOR, TYPE
24
25 SQL::Statement is missing some functions, types, operators etc. It's
26 supported to add missing functionality - but the implementation wasn't
27 picked up during the modernizing of column evaluation. See RT#52397 for
28 some more information.
29
30 This should be done before SQL::Statement 1.xx reaches the end of its
31 road.
32
33 Parser improvements
34
35 The SQL::Parser is implemented based on a lot of regular expressions
36 and some manually developed logic. This creates some issues like
37 RT#53416 or RT#55190. Further, trailing ";" causes SQL::Parser to
38 croak. We need to decide what can be fixed without internal design
39 changes and what has to wait.
40
41 Performance
42
43 There is no intention to work on performance improvements in
44 SQL::Statement 1.xx. The performance is good as it is and improvement
45 requires design changes.
46
47 Reliability
48
49 Bugs will be fixed - where possible. SQL::Statement 1.28 is much more
50 reliable than SQL::Statement 1.15. Even if a bug cannot be fixed all
51 issues are gratefully received as they will be considered in the design
52 process for SQL::Statement 2.xx better.
53
54 Extensibility
55
56 SQL::Statement 1.xx is highly extensible, even if a more object
57 oriented design would improve that. The 1.xx branch will not be
58 redesigned for greater extensibility on a coding level.
59
60 Enhancements in SQL::Statement 2.xx
61 Concerning the procedural design of SQL::Statement 1.xx a rewrite of
62 the basic components is required.
63
64 SQL::Parser rewrite
65
66 The SQL::Parser needs to be modified to be able to use a
67 http://en.wikipedia.org/wiki/Backus_Naur_Form. This would allow users
68 and developers to rely on many different SQL dialects. This will allow
69 better extensibility from a feature point of view without losing ANSI
70 SQL compatibility.
71
72 SQL::Statement rewrite
73
74 SQL::Statement should be reduced to a simple coordinating engine. The
75 executing tasks should be organized into separated commands. This will
76 reduce side effects and will open the door for higher level
77 optimizations, reliability improvements or sub-selects (or other
78 calculated tables).
79
80 Features
81
82 There is a large list of missing features but not all table backends
83 will be able to support each new feature. The most popular requested
84 features need additional discussion and everyone is welcome to do it on
85 the mailto:dbi-dev@perl.org.
86
87 LOCK TABLE
88
89 Locking table within SQL scripts to manually control table consistence
90 over several operations. The current locking support is restricted to
91 one statement.
92
93 Transaction support
94
95 Executing statements on a temporary copy of the table data.
96
97 The easiest way to implement this would be to create a
98 SQL::Statement::RAM on "BEGIN TRANSACTION" and write the entire table
99 back on "COMMIT" or discard on "ROLLBACK".
100
101 Better performance could be acheived when the implementation allows to
102 memorize the single modification and apply them at "COMMIT". This needs
103 more discussion.
104
105 ALTER TABLE
106
107 Adding, removing or modifying columns is not supported for created
108 tables. A generic "ALTER TABLE" seems to rely on the implementation of
109 the transaction support - until better ideas are provided.
110
111 Indices
112
113 Currently some table backends have implicit support to access specified
114 rows quicker than fetching each row and evaluating the where clause
115 against the row data.
116
117 An interface would be required to configure fetching to return only
118 rows matching a restricted where clause. Another (probably better) way
119 to support indices would be to fetch index entries at first and have an
120 interface to the table fetching lines based on an index key.
121
122 Sub-Selects
123
124 In most cases queries can be re-expressed without using sub-selects.
125 But in any case, there are circumstances where sub-selects are
126 required.
127
128 The first implementation will do the sub-select before the primary
129 statement is executed without any further optimization. Hopefully a
130 later version will provide better Performance with some optimization.
131
132 Query based variables
133
134 Currently the only variable I can imagine is "ROWNUM". More suggestions
135 are very welcome.
136
137 Better SQL Script support
138
139 In SQL::Statement 1.xx the function "RUN ()" provides SQL script
140 execution. This function may have limitations and side effects (at
141 least when the executed SQL touched the same tables as the primary
142 statement).
143
144 I plan to improve the SQL script support to remove the side effects on
145 the one hand and have a more flexible and easier way to execute them.
146
147 Finally it should be possible to execute a script via:
148
149 $dbh->do( join( ";", @script ) );
150
151 Trigger support
152
153 Most important when doing complicated things is having callback
154 functions for several events. While real triggers will not be possible
155 for SQL::Statement and underlying pseudo-databases, callbacks could be
156 provided via triggers.
157
158 Performance
159
160 There are several performance optimizations required for SQL::Statement
161 2.xx.
162
163 The first one should be done on a very high level (query optimization)
164 by implementing algebraic evaluation of queries and clean
165 implementation of typical database algorithms. With respect to the
166 basic optimization rule premature optimization is the root of all evil,
167 it is primarily targeted to have an adequately fast, reliable
168 implementation of many algorithms (e.g. early incomplete evaluation to
169 reduce amount of rows, transpose where clause to evaluate constants
170 first) and a clever controller choosing the right algorithm for a
171 specific query.
172
173 The second optimization goal means: implementing most expensive methods
174 in XS. This requires a good performance test suite as well as some real
175 world useage cases.
176
177 Reliability
178
179 This is one of the primary goals of SQL::Statement. I hope to reach it
180 using test driven development and I hope I get some more todo's from
181 the users for this.
182
183 Extensibility
184
185 The currently high level of extensibility should be increased on a
186 coding level. This will be done by redesigning the entire parser and
187 execution engine using object oriented techniques and design patterns.
188
189 Testing
190
191 Many tests in SQL::Statement are not well organized. The tests should
192 be reorganized into several parts:
193
194 Basic API
195 This part should test the entire basic API of SQL::Statement,
196 SQL::Parser and probably the entire engine command classes.
197
198 DBI / Table API
199 This part should test if the API to DBI drivers work (maybe an
200 empty test driver will be needed for that).
201
202 Functionality
203 This part should test the functionality of the SQL::Parser and the
204 SQL::Statement engine.
205
206 Performance
207 This part should be used to implement full useage cases (ideally
208 from real world projects) to allow for testing optimizations.
209
211 Our priorities are localized to our current issues and proof of concept
212 fixes for upcoming SQL::Statement 2.xx.
213
214 Any additional priorities (as missing features, the SQL::Statement
215 rewrite) will come later and can be modified by (paying) users.
216
218 See <http://dbi.perl.org/contributing> for how you can help.
219
220 If your company has benefited from the DBI or SQL::Statement, please
221 consider if it could make a donation to The Perl Foundation "DBI
222 Development" or "SQL::Statement Development" fund at
223 <http://dbi.perl.org/donate> to secure future development.
224
225 Alternatively, if your company would benefit from a specific new DBI or
226 SQL::Statement feature, please consider sponsoring its development
227 through the options listed in the section "Commercial Support from the
228 Author" on <http://dbi.perl.org/support/>.
229
230 Using such targeted financing allows you to contribute to DBI
231 development (including SQL::Statement and PurePerl DBI drivers) and
232 rapidly get something specific and directly valuable to you in return.
233
234 Thank you.
235
236
237
238perl v5.12.1 2010-07-12 SQL::Statement::Roadmap(3)