]> granicus.if.org Git - postgresql/blob - doc/TODO
Update wording:
[postgresql] / doc / TODO
1 PostgreSQL TODO List
2 ====================
3 Current maintainer:     Bruce Momjian (bruce@momjian.us)
4 Last updated:           Fri Jun  1 14:40:33 EDT 2007
5
6 The most recent version of this document can be viewed at
7 http://www.postgresql.org/docs/faqs.TODO.html.
8
9 #A hyphen, "-", marks changes that will appear in the upcoming 8.3 release.#
10 #A percent sign, "%", marks items that are easier to implement.#
11
12 Bracketed items, "[]", have more detail.
13
14 This list contains all known PostgreSQL bugs and feature requests. If
15 you would like to work on an item, please read the Developer's FAQ
16 first.  There is also a developer's wiki at
17 http://developer.postgresql.org.
18
19
20 Administration
21 ==============
22
23 * Allow major upgrades without dump/reload, perhaps using pg_upgrade 
24   [pg_upgrade]
25 * Check for unreferenced table files created by transactions that were
26   in-progress when the server terminated abruptly
27
28   http://archives.postgresql.org/pgsql-patches/2006-06/msg00096.php
29
30 * Allow administrators to safely terminate individual sessions either
31   via an SQL function or SIGTERM 
32
33   Lock table corruption following SIGTERM of an individual backend
34   has been reported in 8.0.  A possible cause was fixed in 8.1, but
35   it is unknown whether other problems exist.  This item mostly
36   requires additional testing rather than of writing any new code.
37   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00174.php
38
39 * Set proper permissions on non-system schemas during db creation
40
41   Currently all schemas are owned by the super-user because they are copied
42   from the template1 database.  However, since all objects are inherited
43   from the template database, it is not clear that setting schemas to the db
44   owner is correct.
45
46 * Support table partitioning that allows a single table to be stored
47   in subtables that are partitioned based on the primary key or a WHERE
48   clause
49 * Add function to report the time of the most recent server reload
50 * Allow statistics collector information to be pulled from the collector
51   process directly, rather than requiring the collector to write a
52   filesystem file twice a second?
53 * Allow log_min_messages to be specified on a per-module basis
54
55   This would allow administrators to see more detailed information from
56   specific sections of the backend, e.g. checkpoints, autovacuum, etc.
57   Another idea is to allow separate configuration files for each module,
58   or allow arbitrary SET commands to be passed to them.
59
60 * Simplify ability to create partitioned tables
61
62   This would allow creation of partitioned tables without requiring
63   creation of rules for INSERT/UPDATE/DELETE, and constraints for
64   rapid partition selection.  Options could include range and hash
65   partition selection.
66   http://archives.postgresql.org/pgsql-hackers/2007-03/msg00375.php
67   http://archives.postgresql.org/pgsql-hackers/2007-04/msg00151.php
68
69 * Allow auto-selection of partitioned tables for min/max() operations
70 * Allow more complex user/database default GUC settings
71
72   Currently ALTER USER and ALTER DATABASE support per-user and
73   per-database defaults.  Consider adding per-user-and-database
74   defaults so things like search_path can be defaulted for a 
75   specific user connecting to a specific database.
76
77 * Allow custom variable classes that can restrict who can set the values
78
79   http://archives.postgresql.org/pgsql-hackers/2006-11/msg00911.php
80
81 * Implement the SQL standard mechanism whereby REVOKE ROLE revokes only
82   the privilege granted by the invoking role, and not those granted
83   by other roles
84
85   http://archives.postgresql.org/pgsql-bugs/2007-05/msg00010.php
86
87
88 * Improve replication solutions
89
90         o Load balancing
91
92           You can use any of the master/slave replication servers to use a
93           standby server for data warehousing. To allow read/write queries to
94           multiple servers, you need multi-master replication like pgcluster.
95
96         o Allow replication over unreliable or non-persistent links
97
98
99 * Configuration files
100
101         o -Allow commenting of variables in postgresql.conf to restore them
102           to defaults
103         o Allow pg_hba.conf to specify host names along with IP addresses
104
105           Host name lookup could occur when the postmaster reads the
106           pg_hba.conf file, or when the backend starts.  Another
107           solution would be to reverse lookup the connection IP and
108           check that hostname against the host names in pg_hba.conf.
109           We could also then check that the host name maps to the IP
110           address.
111
112         o %Allow postgresql.conf file values to be changed via an SQL
113           API, perhaps using SET GLOBAL
114         o Allow the server to be stopped/restarted via an SQL API
115         o Issue a warning if a change-on-restart-only postgresql.conf value
116           is modified  and the server config files are reloaded
117         o Mark change-on-restart-only values in postgresql.conf
118
119
120 * Tablespaces
121
122         o Allow a database in tablespace t1 with tables created in
123           tablespace t2 to be used as a template for a new database created
124           with default tablespace t2
125
126           All objects in the default database tablespace must have default
127           tablespace specifications. This is because new databases are
128           created by copying directories. If you mix default tablespace
129           tables and tablespace-specified tables in the same directory,
130           creating a new database from such a mixed directory would create a
131           new database with tables that had incorrect explicit tablespaces.
132           To fix this would require modifying pg_class in the newly copied
133           database, which we don't currently do.
134
135         o Allow reporting of which objects are in which tablespaces
136
137           This item is difficult because a tablespace can contain objects
138           from multiple databases. There is a server-side function that
139           returns the databases which use a specific tablespace, so this
140           requires a tool that will call that function and connect to each
141           database to find the objects in each database for that tablespace.
142
143         o -Add a GUC variable to control the tablespace for temporary objects
144           and sort files
145
146           It could start with a random tablespace from a supplied list and
147           cycle through the list.
148
149         o Allow WAL replay of CREATE TABLESPACE to work when the directory
150           structure on the recovery computer is different from the original
151
152         o Allow per-tablespace quotas
153
154
155 * Point-In-Time Recovery (PITR)
156
157           o Allow a warm standby system to also allow read-only statements
158             [pitr]
159
160             This is useful for checking PITR recovery.
161             http://archives.postgresql.org/pgsql-hackers/2007-03/msg00050.php
162
163           o %Create dump tool for write-ahead logs for use in determining
164             transaction id for point-in-time recovery
165           o Allow the PITR process to be debugged and data examined
166           o Allow recovery.conf to allow the same syntax as
167             postgresql.conf, including quoting
168
169             http://archives.postgresql.org/pgsql-hackers/2006-12/msg00497.php
170
171
172 Monitoring
173 ==========
174
175 * Allow server log information to be output as INSERT statements
176
177   This would allow server log information to be easily loaded into
178   a database for analysis.
179
180 * -Add ability to monitor the use of temporary sort files
181
182
183 Data Types
184 ==========
185
186 * -Make 64-bit version of the MONEY data type
187 * Add locale-aware MONEY type, and support multiple currencies
188
189   http://archives.postgresql.org/pgsql-general/2005-08/msg01432.php
190   http://archives.postgresql.org/pgsql-hackers/2007-03/msg01181.php
191
192 * Change NUMERIC to enforce the maximum precision
193 * Reduce storage space for small NUMERICs
194
195   http://archives.postgresql.org/pgsql-hackers/2007-02/msg01331.php
196   http://archives.postgresql.org/pgsql-patches/2007-02/msg00505.php
197
198 * Fix data types where equality comparison isn't intuitive, e.g. box
199 * Allow user-defined types to specify a type modifier at table creation
200   time
201 * -Allow user-defined types to accept 'typmod' parameters
202
203   http://archives.postgresql.org/pgsql-hackers/2005-08/msg01142.php
204   http://archives.postgresql.org/pgsql-hackers/2005-09/msg00012.php
205   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00149.php
206
207 * Add support for public SYNONYMs
208
209   http://archives.postgresql.org/pgsql-hackers/2006-03/msg00519.php
210
211 * Fix CREATE CAST on DOMAINs
212
213   http://archives.postgresql.org/pgsql-hackers/2006-05/msg00072.php
214   http://archives.postgresql.org/pgsql-hackers/2006-09/msg01681.php
215
216 * -Add Globally/Universally Unique Identifier (GUID/UUID)
217
218   http://archives.postgresql.org/pgsql-patches/2006-09/msg00209.php
219   http://archives.postgresql.org/pgsql-general/2007-01/msg00853.php
220
221 * Add support for SQL-standard GENERATED/IDENTITY columns
222
223   http://archives.postgresql.org/pgsql-hackers/2006-07/msg00543.php
224   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00038.php
225   http://archives.postgresql.org/pgsql-hackers/2007-05/msg00344.php
226   http://archives.postgresql.org/pgsql-patches/2007-05/msg00076.php
227
228 * -Support a data type with specific enumerated values (ENUM)
229 * Improve XML support
230
231   http://developer.postgresql.org/index.php/XML_Support
232
233 * Consider placing all sequences in a single table, or create a system
234   view
235 * Allow all data types to cast to and from TEXT
236
237   http://archives.postgresql.org/pgsql-hackers/2007-04/msg00017.php
238
239
240 * Dates and Times
241
242         o Allow infinite dates and intervals just like infinite timestamps
243         o Merge hardwired timezone names with the TZ database; allow either 
244           kind everywhere a TZ name is currently taken
245         o Allow TIMESTAMP WITH TIME ZONE to store the original timezone
246           information, either zone name or offset from UTC [timezone]
247
248           If the TIMESTAMP value is stored with a time zone name, interval 
249           computations should adjust based on the time zone rules.
250
251         o Fix SELECT '0.01 years'::interval, '0.01 months'::interval
252         o Add a GUC variable to allow output of interval values in ISO8601 
253           format
254         o Have timestamp subtraction not call justify_hours()?
255
256           http://archives.postgresql.org/pgsql-sql/2006-10/msg00059.php
257
258         o Improve timestamptz subtraction to be DST-aware
259
260           Currently subtracting one date from another that crosses a
261           daylight savings time adjustment can return '1 day 1 hour', but
262           adding that back to the first date returns a time one hour in
263           the future.  This is caused by the adjustment of '25 hours' to
264           '1 day 1 hour', and '1 day' is the same time the next day, even
265           if daylight savings adjustments are involved.
266
267         o Fix interval display to support values exceeding 2^31 hours
268         o Add overflow checking to timestamp and interval arithmetic
269         o Extend timezone code to allow 64-bit values so we can
270           represent years beyond 2038
271
272           http://archives.postgresql.org/pgsql-hackers/2006-09/msg01363.php
273
274         o Use LC_TIME for localized weekday/month names, rather than
275           LC_MESSAGES
276
277           http://archives.postgresql.org/pgsql-hackers/2006-11/msg00390.php
278
279         o Add ISO INTERVAL handling
280
281                   http://archives.postgresql.org/pgsql-hackers/2006-01/msg00250.php
282                   http://archives.postgresql.org/pgsql-bugs/2006-04/msg00248.php
283
284                 o Support ISO INTERVAL syntax if units cannot be determined from
285                   the string, and are supplied after the string
286
287                   The SQL standard states that the units after the string
288                   specify the units of the string, e.g. INTERVAL '2' MINUTE
289                   should return '00:02:00'. The current behavior has the units
290                   restrict the interval value to the specified unit or unit
291                   range, INTERVAL '70' SECOND returns '00:00:10'.
292
293                   For syntax that isn't uniquely ISO or PG syntax, like '1' or
294                   '1:30', treat as ISO if there is a range specification clause,
295                   and as PG if there no clause is present, e.g. interpret '1:30'
296                   MINUTE TO SECOND as '1 minute 30 seconds', and interpret
297                   '1:30' as '1 hour, 30 minutes'.
298
299                   This makes common cases like SELECT INTERVAL '1' MONTH
300                   SQL-standard results. The SQL standard supports a limited
301                   number of unit combinations and doesn't support unit names in
302                   the string. The PostgreSQL syntax is more flexible in the
303                   range of units supported, e.g. PostgreSQL supports '1 year 1
304                   hour', while the SQL standard does not.
305
306                 o Add support for year-month syntax, INTERVAL '50-6' YEAR TO MONTH
307                 o Interpret INTERVAL '1 year' MONTH as CAST (INTERVAL '1 year' AS
308                   INTERVAL MONTH), and this should return '12 months'
309                 o Round or truncate values to the requested precision, e.g.
310                   INTERVAL '11 months' AS YEAR should return one or zero
311                 o Support precision, CREATE TABLE foo (a INTERVAL MONTH(3))
312
313
314 * Arrays
315
316         o Delay resolution of array expression's data type so assignment
317           coercion can be performed on empty array expressions
318         o Add support for arrays of domains
319
320           http://archives.postgresql.org/pgsql-patches/2007-05/msg00114.php
321
322         o -Add support for arrays of complex types
323         o Allow single-byte header storage for array elements
324
325
326 * Binary Data
327
328         o Improve vacuum of large objects, like /contrib/vacuumlo?
329         o Add security checking for large objects
330         o Auto-delete large objects when referencing row is deleted
331
332           /contrib/lo offers this functionality.
333
334         o Allow read/write into TOAST values like large objects
335
336           This requires the TOAST column to be stored EXTERNAL.
337
338         o Add API for 64-bit large object access
339
340           http://archives.postgresql.org/pgsql-hackers/2005-09/msg00781.php
341
342
343 Functions
344 =========
345
346 * Allow INET subnet tests using non-constants to be indexed
347 * Allow to_date() and to_timestamp() accept localized month names
348 * Fix to_date()-related functions to consistently issue errors
349
350   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00915.php
351
352 * Add missing parameter handling in to_char()
353
354         http://archives.postgresql.org/pgsql-hackers/2005-12/msg00948.php
355
356 * Allow functions to have a schema search path specified at creation time
357 * Allow substring/replace() to get/set bit values
358 * Allow to_char() on interval values to accumulate the highest unit
359   requested
360
361   Some special format flag would be required to request such
362   accumulation.  Such functionality could also be added to EXTRACT. 
363   Prevent accumulation that crosses the month/day boundary because of
364   the uneven number of days in a month.
365
366         o to_char(INTERVAL '1 hour 5 minutes', 'MI') => 65
367         o to_char(INTERVAL '43 hours 20 minutes', 'MI' ) => 2600 
368         o to_char(INTERVAL '43 hours 20 minutes', 'WK:DD:HR:MI') => 0:1:19:20
369         o to_char(INTERVAL '3 years 5 months','MM') => 41
370
371 * -Add ISO day of week format 'ID' to to_char() where Monday = 1
372 * -Add a field 'isoyear' to extract(), based on the ISO week
373 * Implement inlining of set-returning functions defined in SQL
374 * Allow SQL-language functions to return results from RETURNING queries
375
376   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00665.php
377
378 * Allow SQL-language functions to reference parameters by parameter name
379
380   Currently SQL-language functions can only refer to dollar parameters,
381   e.g. $1
382
383 * Add SPI_gettypmod() to return the typemod for a TupleDesc
384 * Enforce typmod for function inputs, function results and parameters for
385   spi_prepare'd statements called from PLs
386
387   http://archives.postgresql.org/pgsql-hackers/2007-01/msg01403.php
388
389 * Allow holdable cursors in SPI
390 * Tighten function permission checks
391
392   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00568.php
393
394 * Fix IS OF so it matches the ISO specification, and add documentation
395
396   http://archives.postgresql.org/pgsql-patches/2003-08/msg00060.php
397   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00060.php
398
399 * Add missing operators for geometric data types
400
401   Some geometric types do not have the full suite of geometric operators,
402   e.g. box @> point
403
404
405
406
407 Multi-Language Support
408 ======================
409
410 * Add NCHAR (as distinguished from ordinary varchar),
411 * Allow locale to be set at database creation
412
413   Currently locale can only be set during initdb.  No global tables have
414   locale-aware columns.  However, the database template used during
415   database creation might have locale-aware indexes.  The indexes would
416   need to be reindexed to match the new locale.
417
418 * Allow encoding on a per-column basis optionally using the ICU library:
419
420   Right now only one encoding is allowed per database.  [locale]
421   http://archives.postgresql.org/pgsql-hackers/2005-03/msg00932.php
422   http://archives.postgresql.org/pgsql-patches/2005-08/msg00309.php
423   http://archives.postgresql.org/pgsql-patches/2006-03/msg00233.php
424   http://archives.postgresql.org/pgsql-hackers/2006-09/msg00662.php
425
426 * Add CREATE COLLATE?  [locale]
427 * Support multiple simultaneous character sets, per SQL92
428 * Improve UTF8 combined character handling?
429 * Add octet_length_server() and octet_length_client()
430 * Make octet_length_client() the same as octet_length()?
431 * Fix problems with wrong runtime encoding conversion for NLS message files
432 * Add URL to more complete multi-byte regression tests
433
434   http://archives.postgresql.org/pgsql-hackers/2005-07/msg00272.php
435
436 * Fix ILIKE and regular expressions to handle case insensitivity
437   properly in multibyte encodings
438
439   http://archives.postgresql.org/pgsql-bugs/2005-10/msg00001.php
440   http://archives.postgresql.org/pgsql-patches/2005-11/msg00173.php
441
442 * Set client encoding based on the client operating system encoding
443
444   Currently client_encoding is set in postgresql.conf, which
445   defaults to the server encoding.
446   http://archives.postgresql.org/pgsql-hackers/2006-08/msg01696.php
447
448 * Fix cases where invalid byte encodings are accepted by the database,
449   but throw an error on SELECT
450
451   http://archives.postgresql.org/pgsql-hackers/2007-03/msg00767.php
452
453
454 Views / Rules
455 =============
456
457 * Automatically create rules on views so they are updateable, per SQL99
458
459   We can only auto-create rules for simple views.  For more complex
460   cases users will still have to write rules manually.
461   http://archives.postgresql.org/pgsql-hackers/2006-03/msg00586.php
462   http://archives.postgresql.org/pgsql-patches/2006-08/msg00255.php
463
464 * Add the functionality for WITH CHECK OPTION clause of CREATE VIEW
465 * Allow NOTIFY in rules involving conditionals
466 * Allow VIEW/RULE recompilation when the underlying tables change
467
468   Another issue is whether underlying table changes should be reflected
469   in the view, e.g. should SELECT * show additional columns if they
470   are added after the view is created.
471
472
473 SQL Commands
474 ============
475
476 * Add CORRESPONDING BY to UNION/INTERSECT/EXCEPT
477 * Add ROLLUP, CUBE, GROUPING SETS options to GROUP BY
478 * %Allow SET CONSTRAINTS to be qualified by schema/table name
479 * %Add a separate TRUNCATE permission
480
481   Currently only the owner can TRUNCATE a table because triggers are not
482   called, and the table is locked in exclusive mode.
483
484 * Allow PREPARE of cursors
485 * Allow finer control over the caching of prepared query plans
486
487   Currently queries prepared via the libpq API are planned on first
488   execute using the supplied parameters --- allow SQL PREPARE to do the
489   same.  Also, allow control over replanning prepared queries either
490   manually or automatically when statistics for execute parameters
491   differ dramatically from those used during planning.
492
493 * Improve logging of prepared statements recovered during startup
494
495   http://archives.postgresql.org/pgsql-hackers/2006-11/msg00092.php
496
497 * Allow LISTEN/NOTIFY to store info in memory rather than tables?
498
499   Currently LISTEN/NOTIFY information is stored in pg_listener. Storing
500   such information in memory would improve performance.
501
502 * Add optional textual message to NOTIFY
503
504   This would allow an informational message to be added to the notify
505   message, perhaps indicating the row modified or other custom
506   information.
507
508 * Add a GUC variable to warn about non-standard SQL usage in queries
509 * Add SQL-standard MERGE command, typically used to merge two tables
510   [merge]
511
512   This is similar to UPDATE, then for unmatched rows, INSERT.
513   Whether concurrent access allows modifications which could cause
514   row loss is implementation independent.
515
516 * Add REPLACE or UPSERT command that does UPDATE, or on failure, INSERT
517   [merge]
518
519   To implement this cleanly requires that the table have a unique index
520   so duplicate checking can be easily performed.  It is possible to
521   do it without a unique index if we require the user to LOCK the table
522   before the MERGE.
523   http://archives.postgresql.org/pgsql-hackers/2005-11/msg00501.php
524   http://archives.postgresql.org/pgsql-hackers/2005-11/msg00536.php
525
526
527 * Add NOVICE output level for helpful messages like automatic sequence/index
528   creation
529 * -Add RESET SESSION command to reset all session state
530 * Add GUC to issue notice about statements that use unjoined tables
531 * Allow EXPLAIN to identify tables that were skipped because of 
532   constraint_exclusion
533 * Allow EXPLAIN output to be more easily processed by scripts
534 * Enable standard_conforming_strings
535 * Make standard_conforming_strings the default in 8.4?
536
537   When this is done, backslash-quote should be prohibited in non-E''
538   strings because of possible confusion over how such strings treat
539   backslashes.  Basically, '' is always safe for a literal single
540   quote, while \' might or might not be based on the backslash
541   handling rules.
542
543 * Simplify dropping roles that have objects in several databases
544 * Allow COMMENT ON to accept an expression rather than just a string
545 * Allow the count returned by SELECT, etc to be to represent as an int64
546   to allow a higher range of values
547 * Add SQL99 WITH clause to SELECT
548 * Add SQL:2003 WITH RECURSIVE (hierarchical) queries to SELECT
549 * Add DEFAULT .. AS OWNER so permission checks are done as the table
550   owner
551
552   This would be useful for SERIAL nextval() calls and CHECK constraints.
553
554 * Allow DISTINCT to work in multiple-argument aggregate calls
555 * Add column to pg_stat_activity that shows the progress of long-running
556   commands like CREATE INDEX and VACUUM
557 * Implement SQL:2003 window functions
558 * Improve failure message when DROP DATABASE is used on a database that
559   has prepared transactions
560 * Allow INSERT/UPDATE ... RETURNING inside a SELECT 'FROM' clause
561
562   http://archives.postgresql.org/pgsql-general/2006-09/msg00803.php
563   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00693.php
564
565 * Increase locking when DROPing objects so dependent objects cannot
566   get dropped while the DROP operation is happening
567
568   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00937.php
569
570 * CREATE
571
572         o Allow CREATE TABLE AS to determine column lengths for complex
573           expressions like SELECT col1 || col2
574         o Use more reliable method for CREATE DATABASE to get a consistent
575           copy of db?
576         o Fix transaction restriction checks for CREATE DATABASE and
577           other commands
578
579           http://archives.postgresql.org/pgsql-hackers/2007-01/msg00133.php
580
581         o Have WITH CONSTRAINTS also create constraint indexes
582           http://archives.postgresql.org/pgsql-patches/2007-04/msg00149.php
583
584 * UPDATE
585         o Allow UPDATE tab SET ROW (col, ...) = (SELECT...)
586
587           http://archives.postgresql.org/pgsql-hackers/2006-07/msg01306.php
588           http://archives.postgresql.org/pgsql-hackers/2007-03/msg00865.php
589
590         o Research self-referential UPDATEs that see inconsistent row versions
591           in read-committed mode
592
593           http://archives.postgresql.org/pgsql-hackers/2007-05/msg00507.php
594
595
596 * ALTER
597
598         o %Have ALTER TABLE RENAME rename SERIAL sequence names
599         o Add ALTER DOMAIN to modify the underlying data type
600         o %Allow ALTER TABLE ... ALTER CONSTRAINT ... RENAME
601
602           http://archives.postgresql.org/pgsql-patches/2006-02/msg00168.php
603
604         o %Allow ALTER TABLE to change constraint deferrability and actions
605         o Add missing object types for ALTER ... SET SCHEMA
606         o Allow ALTER TABLESPACE to move to different directories
607         o Allow databases to be moved to different tablespaces
608         o Allow moving system tables to other tablespaces, where possible
609
610           Currently non-global system tables must be in the default database
611           tablespace. Global system tables can never be moved.
612
613         o Prevent parent tables from altering or dropping constraints
614           like CHECK that are inherited by child tables unless CASCADE
615           is used
616         o %Prevent child tables from altering or dropping constraints
617           like CHECK that were inherited from the parent table
618         o Have ALTER INDEX update the name of a constraint using that index
619         o Add ALTER TABLE RENAME CONSTRAINT, update index name also
620         o Allow column display reordering by recording a display,
621           storage, and permanent id for every column?
622
623           http://archives.postgresql.org/pgsql-hackers/2006-12/msg00782.php
624
625
626
627 * CLUSTER
628
629         o -Make CLUSTER preserve recently-dead tuples per MVCC requirements
630         o Automatically maintain clustering on a table
631
632           This might require some background daemon to maintain clustering
633           during periods of low usage. It might also require tables to be only
634           partially filled for easier reorganization.  Another idea would
635           be to create a merged heap/index data file so an index lookup would
636           automatically access the heap data too.  A third idea would be to
637           store heap rows in hashed groups, perhaps using a user-supplied
638           hash function.
639           http://archives.postgresql.org/pgsql-performance/2004-08/msg00349.php
640
641         o %Add default clustering to system tables
642
643           To do this, determine the ideal cluster index for each system
644           table and set the cluster setting during initdb.
645
646         o %Add VERBOSE option to report tables as they are processed,
647           like VACUUM VERBOSE
648         o -Add more logical syntax CLUSTER table USING index;
649           support current syntax for backward compatibility
650
651
652 * COPY
653
654         o Allow COPY to report error lines and continue
655
656           This requires the use of a savepoint before each COPY line is
657           processed, with ROLLBACK on COPY failure.
658
659         o Allow COPY on a newly-created table to skip WAL logging
660
661           On crash recovery, the table involved in the COPY would
662           be removed or have its heap and index files truncated.  One
663           issue is that no other backend should be able to add to 
664           the table at the same time, which is something that is 
665           currently allowed.
666
667
668 * GRANT/REVOKE
669
670         o Allow column-level privileges
671         o %Allow GRANT/REVOKE permissions to be applied to all schema objects
672           with one command
673
674           The proposed syntax is:
675                 GRANT SELECT ON ALL TABLES IN public TO phpuser;
676                 GRANT SELECT ON NEW TABLES IN public TO phpuser;
677
678         o Allow GRANT/REVOKE permissions to be inherited by objects based on
679           schema permissions
680
681         o Allow SERIAL sequences to inherit permissions from the base table?
682
683
684 * CURSOR
685
686         o Allow UPDATE/DELETE WHERE CURRENT OF cursor
687
688           This requires using the row ctid to map cursor rows back to the
689           original heap row. This become more complicated if WITH HOLD cursors
690           are to be supported because WITH HOLD cursors have a copy of the row
691           and no FOR UPDATE lock.
692           http://archives.postgresql.org/pgsql-hackers/2007-01/msg01014.php
693
694         o Prevent DROP TABLE from dropping a row referenced by its own open
695           cursor?
696
697
698 * INSERT
699
700         o Allow INSERT/UPDATE of the system-generated oid value for a row
701         o In rules, allow VALUES() to contain a mixture of 'old' and 'new'
702           references
703
704
705 * SHOW/SET
706
707         o Add SET PERFORMANCE_TIPS option to suggest INDEX, VACUUM, VACUUM
708           ANALYZE, and CLUSTER
709         o Add SET PATH for schemas?
710
711           This is basically the same as SET search_path.
712
713
714 * Referential Integrity
715
716         o Add MATCH PARTIAL referential integrity
717         o Change foreign key constraint for array -> element to mean element
718           in array?
719         o Enforce referential integrity for system tables
720         o Fix problem when cascading referential triggers make changes on
721           cascaded tables, seeing the tables in an intermediate state
722
723           http://archives.postgresql.org/pgsql-hackers/2005-09/msg00174.php
724           http://archives.postgresql.org/pgsql-hackers/2005-09/msg00174.php
725
726         o Allow DEFERRABLE and end-of-statement UNIQUE constraints?
727
728           This would allow UPDATE tab SET col = col + 1 to work if col has
729           a unique index.  Currently, uniqueness checks are done while the
730           command is being executed, rather than at the end of the statement
731           or transaction.
732           http://people.planetpostgresql.org/greg/index.php?/archives/2006/06/10.html
733           http://archives.postgresql.org/pgsql-hackers/2006-09/msg01458.php
734
735
736 * Server-Side Languages
737
738         o PL/pgSQL
739                 o Fix RENAME to work on variables other than OLD/NEW
740
741                   http://archives.postgresql.org/pgsql-hackers/2002-03/msg00591.php
742                   http://archives.postgresql.org/pgsql-hackers/2007-01/msg01615.php
743                   http://archives.postgresql.org/pgsql-hackers/2007-01/msg01587.php
744
745                 o Allow function parameters to be passed by name,
746                   get_employee_salary(12345 AS emp_id, 2001 AS tax_year)
747                 o Add Oracle-style packages  (Pavel)
748
749                   A package would be a schema with session-local variables,
750                   public/private functions, and initialization functions.  It
751                   is also possible to implement these capabilities
752                   in all schemas and not use a separate "packages"
753                   syntax at all.
754                   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00384.php
755
756                 o Allow handling of %TYPE arrays, e.g. tab.col%TYPE[]
757                 o Allow listing of record column names, and access to
758                   record columns via variables, e.g. columns := r.(*),
759                   tval2 := r.(colname)
760
761                   http://archives.postgresql.org/pgsql-patches/2005-07/msg00458.php
762                   http://archives.postgresql.org/pgsql-patches/2006-05/msg00302.php
763                   http://archives.postgresql.org/pgsql-patches/2006-06/msg00031.php
764
765                 o Add single-step debugging of functions
766                 o -Add support for MOVE cursors
767                 o Add support for SCROLL cursors
768                 o Add support for WITH HOLD cursors
769                 o Allow RETURN to return row or record functions
770
771                   http://archives.postgresql.org/pgsql-patches/2005-11/msg00045.php
772                   http://archives.postgresql.org/pgsql-patches/2006-08/msg00397.php
773                   http://archives.postgresql.org/pgsql-hackers/2006-09/msg00388.php
774
775                 o Fix problems with RETURN NEXT on tables with
776                   dropped/added columns after function creation
777
778                   http://archives.postgresql.org/pgsql-patches/2006-02/msg00165.php
779
780                 o Allow row and record variables to be set to NULL constants,
781                   and allow NULL tests on such variables
782
783                   Because a row is not scalar, do not allow assignment
784                   from NULL-valued scalars.
785                   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00070.php
786
787         o Other
788                 o Add table function support to pltcl, plpythonu
789                 o Add support for polymorphic arguments and return types to
790                   languages other than PL/PgSQL
791                 o Add capability to create and call PROCEDURES
792                 o Add support for OUT and INOUT parameters to languages other 
793                   than PL/PgSQL
794                 o Add PL/PythonU tracebacks
795
796                   http://archives.postgresql.org/pgsql-patches/2006-02/msg00288.php
797
798                 o -Allow PL/PythonU to return boolean rather than 1/0
799                 o Allow data to be passed in native language formats, rather
800                   than only text
801
802                   http://archives.postgresql.org/pgsql-hackers/2007-05/msg00289.php
803
804
805 Clients
806 =======
807
808 * Have pg_ctl look at PGHOST in case it is a socket directory?
809 * Allow pg_ctl to work properly with configuration files located outside
810   the PGDATA directory
811
812   pg_ctl can not read the pid file because it isn't located in the
813   config directory but in the PGDATA directory.  The solution is to
814   allow pg_ctl to read and understand postgresql.conf to find the
815   data_directory value.
816
817 * Make consistent use of long/short command options --- pg_ctl needs
818   long ones, pg_config doesn't have short ones, postgres doesn't have
819   enough long ones, etc.
820
821
822 * psql
823
824         o Have psql show current values for a sequence
825         o Move psql backslash database information into the backend, use
826           mnemonic commands? [psql]
827
828           This would allow non-psql clients to pull the same information out
829           of the database as psql.
830
831         o Fix psql's \d commands more consistent
832
833           http://archives.postgresql.org/pgsql-hackers/2004-11/msg00014.php
834           http://archives.postgresql.org/pgsql-hackers/2004-11/msg00014.php
835
836         o -Allow psql \pset boolean variables to set to fixed values, rather
837           than toggle
838         o Consistently display privilege information for all objects in psql
839         o Add auto-expanded mode so expanded output is used if the row
840           length is wider than the screen width.  
841
842           Consider using auto-expanded mode for backslash commands like \df+.
843
844         o Prevent tab completion of SET TRANSACTION from querying the
845           database and therefore preventing the transaction isolation
846           level from being set.
847
848           Currently SET <tab> causes a database lookup to check all
849           supported session variables.  This query causes problems
850           because setting the transaction isolation level must be the
851           first statement of a transaction.
852
853         o Consider parsing the -c string into individual queries so each
854           is run in its own transaction
855
856           http://archives.postgresql.org/pgsql-hackers/2007-01/msg00291.php
857
858         o Add a \set variable to control whether \s displays line numbers
859
860           Another option is to add \# which lists line numbers, and
861           allows command execution.
862
863           http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php
864
865
866 * pg_dump
867
868         o %Add dumping of comments on index columns and composite type columns
869         o %Add full object name to the tag field.  eg. for operators we need
870           '=(integer, integer)', instead of just '='.
871         o Add pg_dumpall custom format dumps?
872         o Remove unnecessary function pointer abstractions in pg_dump source
873           code
874         o Allow selection of individual object(s) of all types, not just
875           tables
876         o In a selective dump, allow dumping of an object and all its 
877           dependencies
878         o Add options like pg_restore -l and -L to pg_dump
879         o Stop dumping CASCADE on DROP TYPE commands in clean mode
880         o Allow pg_dump --clean to drop roles that own objects or have
881           privileges
882         o -Add -f to pg_dumpall
883
884
885 * ecpg
886
887         o Docs
888
889           Document differences between ecpg and the SQL standard and
890           information about the Informix-compatibility module.
891
892         o Solve cardinality > 1 for input descriptors / variables?
893         o Add a semantic check level, e.g. check if a table really exists
894         o fix handling of DB attributes that are arrays
895         o Use backend PREPARE/EXECUTE facility for ecpg where possible
896         o Implement SQLDA
897         o Fix nested C comments
898         o %sqlwarn[6] should be 'W' if the PRECISION or SCALE value specified
899         o Make SET CONNECTION thread-aware, non-standard?
900         o Allow multidimensional arrays
901         o Add internationalized message strings
902         o Implement COPY FROM STDIN
903
904
905 * libpq
906
907         o Add PQescapeIdentifierConn()
908         o Prevent PQfnumber() from lowercasing unquoted the column name
909
910           PQfnumber() should never have been doing lowercasing, but 
911           historically it has so we need a way to prevent it
912
913         o Allow statement results to be automatically batched to the client
914
915           Currently all statement results are transferred to the libpq
916           client before libpq makes the results available to the 
917           application.  This feature would allow the application to make
918           use of the first result rows while the rest are transferred, or
919           held on the server waiting for them to be requested by libpq.
920           One complexity is that a statement like SELECT 1/col could error
921           out mid-way through the result set.
922         o Fix SSL retry to avoid useless repeated connection attempts and
923           ensuing misleading error messages
924         o Consider disallowing multiple queries in PQexec() as an
925           additional barrier to SQL injection attacks
926
927           http://archives.postgresql.org/pgsql-hackers/2007-01/msg00184.php
928
929         o Add PQexecf() that allows complex parameter substitution
930
931           http://archives.postgresql.org/pgsql-hackers/2007-03/msg01803.php
932
933 Triggers
934 ========
935
936 * Add deferred trigger queue file
937
938   Right now all deferred trigger information is stored in backend
939   memory.  This could exhaust memory for very large trigger queues.
940   This item involves dumping large queues into files.
941
942 * Allow triggers to be disabled in only the current session.
943
944   This is currently possible by starting a multi-statement transaction,
945   modifying the system tables, performing the desired SQL, restoring the
946   system tables, and committing the transaction.  ALTER TABLE ...
947   TRIGGER requires a table lock so it is not ideal for this usage.
948
949 * With disabled triggers, allow pg_dump to use ALTER TABLE ADD FOREIGN KEY
950
951   If the dump is known to be valid, allow foreign keys to be added
952   without revalidating the data.
953
954 * Allow statement-level triggers to access modified rows
955 * Support triggers on columns
956
957   http://archives.postgresql.org/pgsql-patches/2005-07/msg00107.php
958
959 * Allow AFTER triggers on system tables
960
961   System tables are modified in many places in the backend without going
962   through the executor and therefore not causing triggers to fire. To
963   complete this item, the functions that modify system tables will have
964   to fire triggers.
965
966 * Tighten trigger permission checks
967
968   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00564.php
969
970 * Allow BEFORE INSERT triggers on views
971
972   http://archives.postgresql.org/pgsql-general/2007-02/msg01466.php
973
974
975
976 Dependency Checking
977 ===================
978
979 * -Flush cached query plans when the dependent objects change or
980   when new ANALYZE statistics are available
981 * -Track dependencies in function bodies and recompile/invalidate
982 * -Invalidate prepared queries, like INSERT, when the table definition
983   is altered
984
985
986 Indexes
987 =======
988
989 * Add UNIQUE capability to non-btree indexes
990 * Prevent index uniqueness checks when UPDATE does not modify the column
991
992   Uniqueness (index) checks are done when updating a column even if the
993   column is not modified by the UPDATE.
994
995 * Allow the creation of on-disk bitmap indexes which can be quickly
996   combined with other bitmap indexes
997
998   Such indexes could be more compact if there are only a few distinct values.
999   Such indexes can also be compressed.  Keeping such indexes updated can be
1000   costly.
1001
1002   http://archives.postgresql.org/pgsql-patches/2005-07/msg00512.php
1003   http://archives.postgresql.org/pgsql-hackers/2006-12/msg01107.php
1004
1005 * -Allow use of indexes to search for NULLs
1006 * Allow accurate statistics to be collected on indexes with more than
1007   one column or expression indexes, perhaps using per-index statistics
1008
1009   http://archives.postgresql.org/pgsql-performance/2006-10/msg00222.php
1010   http://archives.postgresql.org/pgsql-hackers/2007-03/msg01131.php
1011
1012 * -Allow the creation of indexes with mixed ascending/descending
1013   specifiers
1014 * Consider compressing indexes by storing key values duplicated in
1015   several rows as a single index entry
1016
1017   This is difficult because it requires datatype-specific knowledge.
1018
1019 * Add REINDEX CONCURRENTLY, like CREATE INDEX CONCURRENTLY
1020
1021   This is difficult because you must upgrade to an exclusive table lock
1022   to replace the existing index file.  CREATE INDEX CONCURRENTLY does not
1023   have this complication.  This would allow index compaction without
1024   downtime.
1025
1026
1027 * Inheritance
1028
1029         o Allow inherited tables to inherit indexes, UNIQUE constraints,
1030           and primary/foreign keys
1031         o Honor UNIQUE INDEX on base column in INSERTs/UPDATEs
1032           on inherited table, e.g.  INSERT INTO inherit_table
1033           (unique_index_col) VALUES (dup) should fail
1034
1035           The main difficulty with this item is the problem of
1036           creating an index that can span multiple tables.
1037
1038         o Allow SELECT ... FOR UPDATE on inherited tables
1039
1040
1041 * GIST
1042
1043         o Add more GIST index support for geometric data types
1044         o Allow GIST indexes to create certain complex index types, like
1045           digital trees (see Aoki)
1046
1047
1048 * Hash
1049
1050         o Pack hash index buckets onto disk pages more efficiently
1051
1052           Currently only one hash bucket can be stored on a page. Ideally
1053           several hash buckets could be stored on a single page and greater
1054           granularity used for the hash algorithm.
1055
1056           http://archives.postgresql.org/pgsql-hackers/2004-06/msg00168.php
1057
1058         o Consider sorting hash buckets so entries can be found using a
1059           binary search, rather than a linear scan
1060         o In hash indexes, consider storing the hash value with or instead
1061           of the key itself
1062         o Add WAL logging for crash recovery
1063         o Allow multi-column hash indexes
1064         o During index creation, pre-sort the tuples to improve build speed
1065
1066           http://archives.postgresql.org/pgsql-hackers/2007-03/msg01199.php
1067
1068
1069
1070 Fsync
1071 =====
1072
1073 * Improve commit_delay handling to reduce fsync()
1074 * Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options
1075
1076   Ideally this requires a separate test program that can be run
1077   at initdb time or optionally later.  Consider O_SYNC when
1078   O_DIRECT exists.
1079
1080 * %Add an option to sync() before fsync()'ing checkpoint files
1081 * Add program to test if fsync has a delay compared to non-fsync
1082 * Reduce checkpoint performance degredation by forcing data to disk
1083   more evenly
1084
1085   http://archives.postgresql.org/pgsql-patches/2006-12/msg00104.php
1086   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00337.php
1087   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00079.php
1088
1089
1090 Cache Usage
1091 ===========
1092
1093 * Allow free-behind capability for large sequential scans, perhaps using
1094   posix_fadvise()
1095
1096   Posix_fadvise() can control both sequential/random file caching and
1097   free-behind behavior, but it is unclear how the setting affects other
1098   backends that also have the file open, and the feature is not supported
1099   on all operating systems.
1100
1101 * Speed up COUNT(*)
1102
1103   We could use a fixed row count and a +/- count to follow MVCC
1104   visibility rules, or a single cached value could be used and
1105   invalidated if anyone modifies the table.  Another idea is to
1106   get a count directly from a unique index, but for this to be
1107   faster than a sequential scan it must avoid access to the heap
1108   to obtain tuple visibility information.
1109
1110 * Provide a way to calculate an "estimated COUNT(*)"
1111
1112   Perhaps by using the optimizer's cardinality estimates or random
1113   sampling.
1114
1115   http://archives.postgresql.org/pgsql-hackers/2005-11/msg00943.php
1116
1117 * Allow data to be pulled directly from indexes
1118
1119   Currently indexes do not have enough tuple visibility information 
1120   to allow data to be pulled from the index without also accessing 
1121   the heap.  One way to allow this is to set a bit on index tuples 
1122   to indicate if a tuple is currently visible to all transactions 
1123   when the first valid heap lookup happens.  This bit would have to 
1124   be cleared when a heap tuple is expired.  
1125
1126   Another idea is to maintain a bitmap of heap pages where all rows
1127   are visible to all backends, and allow index lookups to reference 
1128   that bitmap to avoid heap lookups, perhaps the same bitmap we might
1129   add someday to determine which heap pages need vacuuming.  Frequently
1130   accessed bitmaps would have to be stored in shared memory.  One 8k
1131   page of bitmaps could track 512MB of heap pages.
1132
1133 * Consider automatic caching of statements at various levels:
1134
1135         o Parsed query tree
1136         o Query execute plan
1137         o Query results
1138
1139 * Allow sequential scans to take advantage of other concurrent
1140   sequential scans, also called "Synchronised Scanning"
1141
1142   One possible implementation is to start sequential scans from the lowest
1143   numbered buffer in the shared cache, and when reaching the end wrap
1144   around to the beginning, rather than always starting sequential scans
1145   at the start of the table.
1146
1147   http://archives.postgresql.org/pgsql-patches/2006-12/msg00076.php
1148   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00408.php
1149   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00784.php
1150   http://archives.postgresql.org/pgsql-hackers/2007-03/msg00415.php
1151
1152 * Consider increasing internal areas when shared buffers is increased
1153
1154   http://archives.postgresql.org/pgsql-hackers/2005-10/msg01419.php
1155
1156 * Consider decreasing the amount of memory used by PrivateRefCount
1157
1158   http://archives.postgresql.org/pgsql-hackers/2006-11/msg00797.php
1159   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00752.php
1160
1161
1162
1163 Vacuum
1164 ======
1165
1166 * Improve speed with indexes
1167
1168   For large table adjustments during VACUUM FULL, it is faster to cluster
1169   or reindex rather than update the index.  Also, index updates can bloat
1170   the index.
1171   http://archives.postgresql.org/pgsql-hackers/2007-03/msg00024.php
1172   http://archives.postgresql.org/pgsql-performance/2007-05/msg00296.php
1173
1174 * Reduce lock time during VACUUM FULL by moving tuples with read lock,
1175   then write lock and truncate table
1176
1177   Moved tuples are invisible to other backends so they don't require a
1178   write lock. However, the read lock promotion to write lock could lead
1179   to deadlock situations.
1180
1181 * Auto-fill the free space map by scanning the buffer cache or by
1182   checking pages written by the background writer
1183
1184   http://archives.postgresql.org/pgsql-hackers/2006-02/msg01125.php
1185   http://archives.postgresql.org/pgsql-hackers/2006-03/msg00011.php
1186
1187 * Create a bitmap of pages that need vacuuming
1188
1189   Instead of sequentially scanning the entire table, have the background
1190   writer or some other process record pages that have expired rows, then
1191   VACUUM can look at just those pages rather than the entire table.  In
1192   the event of a system crash, the bitmap would probably be invalidated.
1193   One complexity is that index entries still have to be vacuumed, and
1194   doing this without an index scan (by using the heap values to find the
1195   index entry) might be slow and unreliable, especially for user-defined
1196   index functions.
1197
1198   http://archives.postgresql.org/pgsql-hackers/2006-12/msg01188.php
1199   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00121.php
1200
1201 * Allow FSM to return free space toward the beginning of the heap file,
1202   in hopes that empty pages at the end can be truncated by VACUUM
1203 * Allow FSM page return free space based on table clustering, to assist
1204   in maintaining clustering?
1205 * Consider shrinking expired tuples to just their headers
1206
1207   http://archives.postgresql.org/pgsql-patches/2006-03/msg00142.php
1208   http://archives.postgresql.org/pgsql-hackers/2007-01/msg01025.php
1209
1210 * Allow heap reuse of UPDATEd rows if no indexed columns are changed,
1211   and old and new versions are on the same heap page?
1212
1213   While vacuum handles DELETEs fine, updating of non-indexed columns, like
1214   counters, are difficult for VACUUM to handle efficiently.  This method
1215   is possible for same-page updates because a single index row can be
1216   used to point to both old and new values.
1217   http://archives.postgresql.org/pgsql-hackers/2006-06/msg01305.php
1218   http://archives.postgresql.org/pgsql-hackers/2006-06/msg01534.php
1219
1220 * Reuse index tuples that point to heap tuples that are not visible to 
1221   anyone?
1222 * Improve dead row detection during multi-statement transactions usage
1223
1224   http://archives.postgresql.org/pgsql-patches/2007-03/msg00358.php
1225
1226 * Auto-vacuum
1227
1228         o Use free-space map information to guide refilling
1229         o %Issue log message to suggest VACUUM FULL if a table is nearly
1230           empty?
1231         o Consider logging activity either to the logs or a system view
1232         o -Turn on by default
1233         o -Allow multiple vacuums so large tables do not starve small
1234           tables
1235         o Improve control of auto-vacuum
1236
1237           http://archives.postgresql.org/pgsql-hackers/2006-12/msg00876.php
1238
1239
1240 Locking
1241 =======
1242
1243 * Fix priority ordering of read and write light-weight locks (Neil)
1244
1245   http://archives.postgresql.org/pgsql-hackers/2004-11/msg00893.php
1246   http://archives.postgresql.org/pgsql-hackers/2004-11/msg00905.php
1247
1248 * Fix problem when multiple subtransactions of the same outer transaction
1249   hold different types of locks, and one subtransaction aborts
1250
1251   http://archives.postgresql.org/pgsql-hackers/2006-11/msg01011.php
1252   http://archives.postgresql.org/pgsql-hackers/2006-12/msg00001.php
1253   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00435.php
1254
1255 * Allow UPDATEs on only non-referential integrity columns not to conflict
1256   with referential integrity locks
1257
1258   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00073.php
1259
1260 * Add idle_in_transaction_timeout GUC so locks are not held for long
1261   periods of time
1262
1263
1264
1265 Startup Time Improvements
1266 =========================
1267
1268 * Experiment with multi-threaded backend for backend creation [thread]
1269
1270   This would prevent the overhead associated with process creation. Most
1271   operating systems have trivial process creation time compared to
1272   database startup overhead, but a few operating systems (Win32,
1273   Solaris) might benefit from threading.  Also explore the idea of
1274   a single session using multiple threads to execute a statement faster.
1275
1276 * Experiment with multi-threaded backend better resource utilization
1277
1278   This would allow a single query to make use of multiple CPU's or
1279   multiple I/O channels simultaneously.  One idea is to create a
1280   background reader that can pre-fetch sequential and index scan
1281   pages needed by other backends.  This could be expanded to allow
1282   concurrent reads from multiple devices in a partitioned table.
1283
1284 * Add connection pooling
1285
1286   It is unclear if this should be done inside the backend code or done
1287   by something external like pgpool. The passing of file descriptors to
1288   existing backends is one of the difficulties with a backend approach.
1289
1290
1291 Write-Ahead Log
1292 ===============
1293
1294 * Eliminate need to write full pages to WAL before page modification [wal]
1295
1296   Currently, to protect against partial disk page writes, we write
1297   full page images to WAL before they are modified so we can correct any
1298   partial page writes during recovery.  These pages can also be
1299   eliminated from point-in-time archive files.
1300
1301         o  When off, write CRC to WAL and check file system blocks
1302            on recovery
1303
1304            If CRC check fails during recovery, remember the page in case
1305            a later CRC for that page properly matches.
1306
1307         o  Write full pages during file system write and not when
1308            the page is modified in the buffer cache
1309
1310            This allows most full page writes to happen in the background
1311            writer.  It might cause problems for applying WAL on recovery
1312            into a partially-written page, but later the full page will be
1313            replaced from WAL.
1314
1315 * Allow WAL traffic to be streamed to another server for stand-by
1316   replication
1317 * Reduce WAL traffic so only modified values are written rather than
1318   entire rows
1319
1320   http://archives.postgresql.org/pgsql-hackers/2007-03/msg01589.php
1321
1322 * -Allow the pg_xlog directory location to be specified during initdb
1323   with a symlink back to the /data location
1324 * Allow WAL information to recover corrupted pg_controldata
1325
1326   http://archives.postgresql.org/pgsql-patches/2006-06/msg00025.php
1327
1328 * Find a way to reduce rotational delay when repeatedly writing
1329   last WAL page
1330
1331   Currently fsync of WAL requires the disk platter to perform a full
1332   rotation to fsync again. One idea is to write the WAL to different
1333   offsets that might reduce the rotational delay.
1334
1335 * Allow buffered WAL writes and fsync
1336
1337   Instead of guaranteeing recovery of all committed transactions, this
1338   would provide improved performance by delaying WAL writes and fsync
1339   so an abrupt operating system restart might lose a few seconds of
1340   committed transactions but still be consistent.  We could perhaps
1341   remove the 'fsync' parameter (which results in an an inconsistent
1342   database) in favor of this capability.
1343
1344 * Allow WAL logging to be turned off for a table, but the table
1345   might be dropped or truncated during crash recovery [walcontrol]
1346
1347   Allow tables to bypass WAL writes and just fsync() dirty pages on
1348   commit.  This should be implemented using ALTER TABLE, e.g. ALTER 
1349   TABLE PERSISTENCE [ DROP | TRUNCATE | DEFAULT ].  Tables using 
1350   non-default logging should not use referential integrity with 
1351   default-logging tables.  A table without dirty buffers during a
1352   crash could perhaps avoid the drop/truncate.
1353
1354 * Allow WAL logging to be turned off for a table, but the table would
1355   avoid being truncated/dropped [walcontrol]
1356
1357   To do this, only a single writer can modify the table, and writes 
1358   must happen only on new pages so the new pages can be removed during
1359   crash recovery.  Readers can continue accessing the table.  Such 
1360   tables probably cannot have indexes.  One complexity is the handling 
1361   of indexes on TOAST tables.
1362
1363
1364 Optimizer / Executor
1365 ====================
1366
1367 * Improve selectivity functions for geometric operators
1368 * -Allow ORDER BY ... LIMIT # to select high/low value without sort or
1369   index using a sequential scan for highest/lowest values
1370 * Precompile SQL functions to avoid overhead
1371 * Create utility to compute accurate random_page_cost value
1372 * Improve ability to display optimizer analysis using OPTIMIZER_DEBUG
1373 * Have EXPLAIN ANALYZE issue NOTICE messages when the estimated and
1374   actual row counts differ by a specified percentage
1375 * Consider using hash buckets to do DISTINCT, rather than sorting
1376
1377   This would be beneficial when there are few distinct values.  This is
1378   already used by GROUP BY.
1379
1380 * Log statements where the optimizer row estimates were dramatically
1381   different from the number of rows actually found?
1382 * Consider compressed annealing to search for query plans
1383
1384   This might replace GEQO, http://sixdemonbag.org/Djinni.
1385
1386 * Improve merge join performance by allowing mark/restore of 
1387   tuple sources
1388
1389   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00096.php
1390
1391
1392
1393 Miscellaneous Performance
1394 =========================
1395
1396 * Do async I/O for faster random read-ahead of data
1397
1398   Async I/O allows multiple I/O requests to be sent to the disk with
1399   results coming back asynchronously.
1400   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00820.php
1401
1402 * Use mmap() rather than SYSV shared memory or to write WAL files?
1403
1404   This would remove the requirement for SYSV SHM but would introduce
1405   portability issues. Anonymous mmap (or mmap to /dev/zero) is required
1406   to prevent I/O overhead.
1407
1408 * Consider mmap()'ing files into a backend?
1409
1410   Doing I/O to large tables would consume a lot of address space or
1411   require frequent mapping/unmapping.  Extending the file also causes
1412   mapping problems that might require mapping only individual pages,
1413   leading to thousands of mappings.  Another problem is that there is no
1414   way to _prevent_ I/O to disk from the dirty shared buffers so changes
1415   could hit disk before WAL is written.
1416
1417 * Add a script to ask system configuration questions and tune postgresql.conf
1418 * -Merge xmin/xmax/cmin/cmax back into three header fields
1419 * Consider ways of storing rows more compactly on disk
1420
1421         o -Support a smaller header for short variable-length fields
1422         o Reduce the row header size?
1423         o Consider reducing on-disk varlena length from four bytes to 
1424           two because a heap row cannot be more than 64k in length
1425
1426 * Consider increasing NUM_CLOG_BUFFERS
1427 * Consider having the background writer update the transaction status
1428   hint bits before writing out the page
1429 * Allow user configuration of TOAST thresholds
1430
1431   http://archives.postgresql.org/pgsql-hackers/2007-02/msg00213.php
1432
1433 * Allow configuration of backend priorities via the operating system
1434
1435   Though backend priorities make priority inversion during lock
1436   waits possible, research shows that this is not a huge problem.
1437   http://archives.postgresql.org/pgsql-general/2007-02/msg00493.php
1438
1439 * Consider reducing memory used for shared buffer reference count
1440
1441   http://archives.postgresql.org/pgsql-hackers/2007-01/msg00752.php
1442
1443
1444
1445 Source Code
1446 ===========
1447
1448 * Add use of 'const' for variables in source tree
1449 * Move some things from /contrib into main tree
1450 * %Remove warnings created by -Wcast-align
1451 * Move platform-specific ps status display info from ps_status.c to ports
1452 * Add optional CRC checksum to heap and index pages
1453 * Improve documentation to build only interfaces (Marc)
1454 * Remove or relicense modules that are not under the BSD license, if possible
1455 * %Remove memory/file descriptor freeing before ereport(ERROR)
1456 * Acquire lock on a relation before building a relcache entry for it
1457 * %Promote debug_query_string into a server-side function current_query()
1458 * Allow cross-compiling by generating the zic database on the target system
1459 * Improve NLS maintenance of libpgport messages linked onto applications
1460 * Allow ecpg to work with MSVC and BCC
1461 * Add xpath_array() to /contrib/xml2 to return results as an array
1462 * Clean up casting in /contrib/isn
1463
1464   http://archives.postgresql.org/pgsql-hackers/2006-11/msg00245.php
1465
1466 * Allow building in directories containing spaces
1467
1468   This is probably not possible because 'gmake' and other compiler tools
1469   do not fully support quoting of paths with spaces.
1470
1471 * Fix sgmltools so PDFs can be generated with bookmarks
1472 * Use UTF8 encoding for NLS messages so all server encodings can
1473   read them properly
1474 * Update Bonjour to work with newer cross-platform SDK
1475
1476   http://archives.postgresql.org/pgsql-hackers/2006-09/msg02238.php
1477   http://archives.postgresql.org/pgsql-patches/2006-10/msg00048.php
1478
1479 * Split out libpq pgpass and environment documentation sections to make
1480   it easier for non-developers to find
1481 * Consider detoasting keys before sorting
1482 * Consider GnuTLS if OpenSSL license becomes a problem
1483
1484   http://archives.postgresql.org/pgsql-patches/2006-05/msg00040.php
1485   http://archives.postgresql.org/pgsql-hackers/2006-12/msg01213.php
1486
1487 * Use strlcpy() rather than our StrNCpy() macro
1488
1489   http://archives.postgresql.org/pgsql-hackers/2006-09/msg02108.php
1490
1491 * Consider changing documentation format from SGML to XML
1492
1493   http://archives.postgresql.org/pgsql-docs/2006-12/msg00152.php
1494
1495 * -Move NAMEDATALEN from postgres_ext.h to pg_config_manual.h
1496 * Consider making NAMEDATALEN more configurable in future releases
1497 * Update our code to handle 64-bit timezone files to match the zic 
1498   source code, which now uses them
1499 * Have configure choose integer datetimes by default
1500
1501   http://archives.postgresql.org/pgsql-patches/2007-05/msg00046.php
1502
1503 * -Fix problem with excessive logging during SSL disconnection
1504
1505   http://archives.postgresql.org/pgsql-bugs/2006-12/msg00122.php
1506   http://archives.postgresql.org/pgsql-bugs/2007-05/msg00065.php
1507
1508 * Support scoped IPv6 addresses
1509
1510   http://archives.postgresql.org/pgsql-bugs/2007-05/msg00111.php
1511
1512 * Consider allowing 64-bit integers and floats to be passed by value on
1513   64-bit platforms
1514
1515   Also change 32-bit floats (float4) to be passed by value at the same
1516   time.
1517
1518
1519
1520 * Win32
1521
1522         o Remove configure.in check for link failure when cause is found
1523         o Remove readdir() errno patch when runtime/mingwex/dirent.c rev
1524           1.4 is released
1525         o Remove psql newline patch when we find out why mingw outputs an
1526           extra newline
1527         o Allow psql to use readline once non-US code pages work with
1528           backslashes
1529         o Re-enable timezone output on log_line_prefix '%t' when a
1530           shorter timezone string is available
1531         o Fix problem with shared memory on the Win32 Terminal Server
1532         o Improve signal handling
1533
1534           http://archives.postgresql.org/pgsql-patches/2005-06/msg00027.php
1535
1536         o -Add long file support for binary pg_dump output
1537         o Check WSACancelBlockingCall() for interrupts [win32intr]
1538
1539
1540 * Wire Protocol Changes
1541
1542         o Allow dynamic character set handling
1543         o Add decoded type, length, precision
1544         o Use compression?
1545         o Update clients to use data types, typmod, schema.table.column names
1546           of result sets using new statement protocol
1547
1548
1549 Exotic Features
1550 ===============
1551
1552 * Add pre-parsing phase that converts non-ISO syntax to supported
1553   syntax
1554
1555   This could allow SQL written for other databases to run without
1556   modification.
1557
1558 * Allow plug-in modules to emulate features from other databases
1559 * SQL*Net listener that makes PostgreSQL appear as an Oracle database
1560   to clients
1561 * Allow statements across databases or servers with transaction
1562   semantics
1563
1564   This can be done using dblink and two-phase commit.
1565
1566 * Add the features of packages
1567
1568         o  Make private objects accessible only to objects in the same schema
1569         o  Allow current_schema.objname to access current schema objects
1570         o  Add session variables
1571         o  Allow nested schemas
1572
1573 * Consider allowing control of upper/lower case folding of unquoted
1574   identifiers
1575
1576   http://archives.postgresql.org/pgsql-hackers/2004-04/msg00818.php
1577   http://archives.postgresql.org/pgsql-hackers/2006-10/msg01527.php
1578
1579
1580 Features We Do _Not_ Want
1581 =========================
1582
1583 * All backends running as threads in a single process (not wanted)
1584
1585   This eliminates the process protection we get from the current setup.
1586   Thread creation is usually the same overhead as process creation on
1587   modern systems, so it seems unwise to use a pure threaded model.
1588
1589 * Optimizer hints (not wanted)
1590
1591   Optimizer hints are used to work around problems in the optimizer.  We
1592   would rather have the problems reported and fixed.
1593   http://archives.postgresql.org/pgsql-hackers/2006-08/msg00506.php
1594   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00517.php
1595   http://archives.postgresql.org/pgsql-hackers/2006-10/msg00663.php
1596
1597 * Allow AS in "SELECT col AS label" to be optional (not wanted)
1598
1599   Because we support postfix operators, it isn't possible to make AS
1600   optional and continue to use bison.
1601   http://archives.postgresql.org/pgsql-sql/2006-08/msg00164.php
1602
1603 * Embedded server (not wanted)
1604
1605   While PostgreSQL clients runs fine in limited-resource environments, the
1606   server requires multiple processes and a stable pool of resources to
1607   run reliabily and efficiently.  Stripping down the PostgreSQL server 
1608   to run in the same process address space as the client application 
1609   would add too much complexity and failure cases.