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