]> granicus.if.org Git - postgresql/blob - doc/TODO
enable_constraint_exclusion => constraint_exclusion
[postgresql] / doc / TODO
1
2 PostgreSQL TODO List
3 ====================
4 Current maintainer:     Bruce Momjian (pgman@candle.pha.pa.us)
5 Last updated:           Sat Aug 20 21:04:41 EDT 2005
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.1 release.#
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.
17
18
19 Administration
20 ==============
21
22 * Remove behavior of postmaster -o after making postmaster/postgres
23   flags unique
24 * -Allow limits on per-db/role connections
25 * Allow pooled connections to list all prepared queries
26
27   This would allow an application inheriting a pooled connection to know
28   the queries prepared in the current session.
29
30 * Allow major upgrades without dump/reload, perhaps using pg_upgrade 
31   [pg_upgrade]
32 * Check for unreferenced table files created by transactions that were
33   in-progress when the server terminated abruptly
34 * Allow administrators to safely terminate individual sessions either
35   via an SQL function or SIGTERM 
36
37   Currently SIGTERM of a backend can lead to lock table corruption.
38
39 * -Prevent dropping user that still owns objects, or auto-drop the objects
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 * -Add the client IP address and port to pg_stat_activity
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
50
51 * Improve replication solutions
52
53         o Load balancing
54
55           You can use any of the master/slave replication servers to use a
56           standby server for data warehousing. To allow read/write queries to
57           multiple servers, you need multi-master replication like pgcluster.
58
59         o Allow replication over unreliable or non-persistent links
60
61
62 * Configuration files
63
64         o Add "include file" functionality in postgresql.conf
65         o Allow postgresql.conf values to be set so they can not be changed
66           by the user
67         o Allow commenting of variables in postgresql.conf to restore them
68           to defaults
69         o Allow pg_hba.conf settings to be controlled via SQL
70
71           This would add a function to load the SQL table from
72           pg_hba.conf, and one to writes its contents to the flat file.
73           The table should have a line number that is a float so rows
74           can be inserted between existing rows, e.g. row 2.5 goes
75           between row 2 and row 3.
76
77         o Allow postgresql.conf file values to be changed via an SQL
78           API, perhaps using SET GLOBAL
79         o Allow the server to be stopped/restarted via an SQL API
80
81
82 * Tablespaces
83
84         * Allow a database in tablespace t1 with tables created in
85           tablespace t2 to be used as a template for a new database created
86           with default tablespace t2
87
88           All objects in the default database tablespace must have default
89           tablespace specifications. This is because new databases are
90           created by copying directories. If you mix default tablespace
91           tables and tablespace-specified tables in the same directory,
92           creating a new database from such a mixed directory would create a
93           new database with tables that had incorrect explicit tablespaces.
94           To fix this would require modifying pg_class in the newly copied
95           database, which we don't currently do.
96
97         * Allow reporting of which objects are in which tablespaces
98
99           This item is difficult because a tablespace can contain objects
100           from multiple databases. There is a server-side function that
101           returns the databases which use a specific tablespace, so this
102           requires a tool that will call that function and connect to each
103           database to find the objects in each database for that tablespace.
104
105         o Add a GUC variable to control the tablespace for temporary objects
106           and sort files
107
108           It could start with a random tablespace from a supplied list and
109           cycle through the list.
110
111         o Allow WAL replay of CREATE TABLESPACE to work when the directory
112           structure on the recovery computer is different from the original
113
114         o Allow per-tablespace quotas
115
116
117 * Point-In-Time Recovery (PITR)
118
119           o Allow point-in-time recovery to archive partially filled
120             write-ahead logs [pitr]
121
122             Currently only full WAL files are archived. This means that the
123             most recent transactions aren't available for recovery in case
124             of a disk failure. This could be triggered by a user command or
125             a timer.
126
127           o Automatically force archiving of partially-filled WAL files when
128             pg_stop_backup() is called or the server is stopped
129
130             Doing this will allow administrators to know more easily when
131             the archive contins all the files needed for point-in-time
132             recovery.
133
134           o Create dump tool for write-ahead logs for use in determining
135             transaction id for point-in-time recovery
136           o Allow a warm standby system to also allow read-only queries
137             [pitr]
138
139             This is useful for checking PITR recovery.
140
141           o Allow the PITR process to be debugged and data examined
142
143
144 Monitoring
145 ==========
146
147 * Allow server log information to be output as INSERT statements
148
149   This would allow server log information to be easily loaded into
150   a database for analysis.
151
152 * Add ability to monitor the use of temporary sort files
153 * -Add session start time and last statement time to pg_stat_activity
154 * -Add a function that returns the start time of the postmaster
155 * Allow server logs to be remotely read and removed using SQL commands
156
157
158 Data Types
159 ==========
160
161 * Remove Money type, add money formatting for decimal type
162 * Change NUMERIC to enforce the maximum precision, and increase it
163 * Add NUMERIC division operator that doesn't round?
164
165   Currently NUMERIC _rounds_ the result to the specified precision.  
166   This means division can return a result that multiplied by the 
167   divisor is greater than the dividend, e.g. this returns a value > 10:
168
169     SELECT (10::numeric(2,0) / 6::numeric(2,0))::numeric(2,0) * 6;
170
171   The positive modulus result returned by NUMERICs might be considered
172   inaccurate, in one sense.
173
174 * Have sequence dependency track use of DEFAULT sequences,
175   seqname.nextval?
176 * Disallow changing default expression of a SERIAL column?
177 * Fix data types where equality comparison isn't intuitive, e.g. box
178 * Prevent INET cast to CIDR if the unmasked bits are not zero, or
179   zero the bits
180 * Prevent INET cast to CIDR from droping netmask, SELECT '1.1.1.1'::inet::cidr
181 * Allow INET + INT4 to increment the host part of the address, or
182   throw an error on overflow
183 * Add 'tid != tid ' operator for use in corruption recovery
184
185
186 * Dates and Times
187
188         o Allow infinite dates just like infinite timestamps
189         o Add a GUC variable to allow output of interval values in ISO8601 
190           format
191         o Merge hardwired timezone names with the TZ database; allow either 
192           kind everywhere a TZ name is currently taken
193         o Allow customization of the known set of TZ names (generalize the
194           present australian_timezones hack)
195         o Allow TIMESTAMP WITH TIME ZONE to store the original timezone
196           information, either zone name or offset from UTC [timezone]
197
198           If the TIMESTAMP value is stored with a time zone name, interval 
199           computations should adjust based on the time zone rules.
200
201         o Add ISO INTERVAL handling
202                 o Add support for day-time syntax, INTERVAL '1 2:03:04' DAY TO 
203                   SECOND
204                 o Add support for year-month syntax, INTERVAL '50-6' YEAR TO MONTH
205                 o For syntax that isn't uniquely ISO or PG syntax, like '1:30' or
206                   '1', treat as ISO if there is a range specification clause,
207                   and as PG if there no clause is present, e.g. interpret 
208                           '1:30' MINUTE TO SECOND as '1 minute 30 seconds', and 
209                           interpret '1:30' as '1 hour, 30 minutes'
210                 o Interpret INTERVAL '1 year' MONTH as CAST (INTERVAL '1 year' AS
211                   INTERVAL MONTH), and this should return '12 months'
212                 o Round or truncate values to the requested precision, e.g.
213                   INTERVAL '11 months' AS YEAR should return one or zero
214                 o Support precision, CREATE TABLE foo (a INTERVAL MONTH(3))
215
216
217 * Arrays
218
219         o Allow NULLs in arrays
220         o Allow MIN()/MAX() on arrays
221         o Delay resolution of array expression's data type so assignment
222           coercion can be performed on empty array expressions
223         o Modify array literal representation to handle array index lower bound
224           of other than one
225
226
227 * Binary Data
228
229         o Improve vacuum of large objects, like /contrib/vacuumlo?
230         o Add security checking for large objects
231
232           Currently large objects entries do not have owners. Permissions can
233           only be set at the pg_largeobject table level.
234
235         o Auto-delete large objects when referencing row is deleted
236         o Allow read/write into TOAST values like large objects
237
238           This requires the TOAST column to be stored EXTERNAL.
239
240
241 Functions
242 =========
243
244 * -Add function to return compressed length of TOAST data values
245 * Allow INET subnet tests using non-constants to be indexed
246 * Add transaction_timestamp(), statement_timestamp(), clock_timestamp()
247   functionality
248
249   Current CURRENT_TIMESTAMP returns the start time of the current
250   transaction, and gettimeofday() returns the wallclock time. This will
251   make time reporting more consistent and will allow reporting of
252   the statement start time.
253
254 * Add pg_get_acldef(), pg_get_typedefault(), and pg_get_attrdef()
255 * Allow to_char() to print localized month names
256 * Allow functions to have a schema search path specified at creation time
257 * Allow substring/replace() to get/set bit values
258 * Allow to_char() on interval values to accumulate the highest unit
259   requested
260
261   Some special format flag would be required to request such
262   accumulation.  Such functionality could also be added to EXTRACT. 
263   Prevent accumulation that crosses the month/day boundary because of
264   the uneven number of days in a month.
265
266         o to_char(INTERVAL '1 hour 5 minutes', 'MI') => 65
267         o to_char(INTERVAL '43 hours 20 minutes', 'MI' ) => 2600 
268         o to_char(INTERVAL '43 hours 20 minutes', 'WK:DD:HR:MI') => 0:1:19:20
269         o to_char(INTERVAL '3 years 5 months','MM') => 41
270
271 * -Prevent to_char() on interval from returning meaningless values
272
273   For example, to_char('1 month', 'mon') is meaningless.  Basically,
274   most date-related parameters to to_char() are meaningless for
275   intervals because interval is not anchored to a date.
276
277
278 Multi-Language Support
279 ======================
280
281 * Add NCHAR (as distinguished from ordinary varchar),
282 * Allow locale to be set at database creation
283
284   Currently locale can only be set during initdb.  No global tables have
285   locale-aware columns.  However, the database template used during
286   database creation might have locale-aware indexes.  The indexes would
287   need to be reindexed to match the new locale.
288
289 * Allow encoding on a per-column basis
290
291   Right now only one encoding is allowed per database.
292
293 * Support multiple simultaneous character sets, per SQL92
294 * Improve UTF8 combined character handling?
295 * Add octet_length_server() and octet_length_client()
296 * Make octet_length_client() the same as octet_length()?
297 * Fix problems with wrong runtime encoding conversion for NLS message files
298
299
300 Views / Rules
301 =============
302
303 * Automatically create rules on views so they are updateable, per SQL99
304
305   We can only auto-create rules for simple views.  For more complex
306   cases users will still have to write rules.
307
308 * Add the functionality for WITH CHECK OPTION clause of CREATE VIEW
309 * Allow NOTIFY in rules involving conditionals
310 * Have views on temporary tables exist in the temporary namespace
311 * Allow temporary views on non-temporary tables
312 * Allow RULE recompilation
313
314
315 SQL Commands
316 ============
317
318 * -Add BETWEEN SYMMETRIC/ASYMMETRIC
319 * Change LIMIT/OFFSET and FETCH/MOVE to use int8
320 * -Add E'' escape string marker so eventually ordinary strings can treat
321   backslashes literally, for portability
322
323 * -Allow additional tables to be specified in DELETE for joins
324
325   UPDATE already allows this (UPDATE...FROM) but we need similar
326   functionality in DELETE.  It's been agreed that the keyword should
327   be USING, to avoid anything as confusing as DELETE FROM a FROM b.
328
329 * Add CORRESPONDING BY to UNION/INTERSECT/EXCEPT
330 * -Allow REINDEX to rebuild all database indexes
331 * Add ROLLUP, CUBE, GROUPING SETS options to GROUP BY
332 * Allow SET CONSTRAINTS to be qualified by schema/table name
333 * Allow TRUNCATE ... CASCADE/RESTRICT
334 * Add a separate TRUNCATE permission
335
336   Currently only the owner can TRUNCATE a table because triggers are not
337   called, and the table is locked in exclusive mode.
338
339 * Allow PREPARE of cursors
340 * Allow PREPARE to automatically determine parameter types based on the SQL
341   statement
342 * Allow finer control over the caching of prepared query plans
343
344   Currently, queries prepared via the libpq API are planned on first
345   execute using the supplied parameters --- allow SQL PREPARE to do the
346   same.  Also, allow control over replanning prepared queries either
347   manually or automatically when statistics for execute parameters
348   differ dramatically from those used during planning.
349
350 * Allow LISTEN/NOTIFY to store info in memory rather than tables?
351
352   Currently LISTEN/NOTIFY information is stored in pg_listener. Storing
353   such information in memory would improve performance.
354
355 * Add optional textual message to NOTIFY
356
357   This would allow an informational message to be added to the notify
358   message, perhaps indicating the row modified or other custom
359   information.
360
361 * Add a GUC variable to warn about non-standard SQL usage in queries
362 * Add MERGE command that does UPDATE/DELETE, or on failure, INSERT (rules,
363   triggers?)
364 * Add NOVICE output level for helpful messages like automatic sequence/index
365   creation
366 * Add COMMENT ON for all cluster global objects (roles, databases
367   and tablespaces)
368 * -Add an option to automatically use savepoints for each statement in a
369   multi-statement transaction.
370
371   When enabled, this would allow errors in multi-statement transactions
372   to be automatically ignored.
373
374 * Make row-wise comparisons work per SQL spec
375 * Add RESET CONNECTION command to reset all session state
376
377   This would include resetting of all variables (RESET ALL), dropping of
378   temporary tables, removing any NOTIFYs, cursors, open transactions,
379   prepared queries, currval()s, etc.  This could be used  for connection
380   pooling.  We could also change RESET ALL to have this functionality.  
381   The difficult of this features is allowing RESET ALL to not affect 
382   changes made by the interface driver for its internal use.  One idea 
383   is for this to be a protocol-only feature.  Another approach is to 
384   notify the protocol when a RESET CONNECTION command is used.
385
386 * Add GUC to issue notice about queries that use unjoined tables
387 * Allow EXPLAIN to identify tables that were skipped because of 
388   constraint_exclusion
389 * Allow EXPLAIN output to be more easily processed by scripts
390
391
392 * CREATE
393
394         o Allow CREATE TABLE AS to determine column lengths for complex
395           expressions like SELECT col1 || col2
396
397         o Use more reliable method for CREATE DATABASE to get a consistent
398           copy of db?
399
400         o Currently the system uses the operating system COPY command to
401           create a new database. Add ON COMMIT capability to CREATE TABLE AS
402           SELECT
403
404
405 * UPDATE
406         o Allow UPDATE to handle complex aggregates [update]?
407         o Allow an alias to be provided for the target table in
408           UPDATE/DELETE
409
410           This is not SQL-spec but many DBMSs allow it.
411
412         o Allow UPDATE tab SET ROW (col, ...) = (...) for updating multiple
413           columns
414         o -Allow FOR UPDATE queries to do NOWAIT locks
415
416
417 * ALTER
418
419         o Have ALTER TABLE RENAME rename SERIAL sequence names
420         o Add ALTER DOMAIN TYPE
421         o Allow ALTER TABLE ... ALTER CONSTRAINT ... RENAME
422         o Allow ALTER TABLE to change constraint deferrability and actions
423         o Disallow dropping of an inherited constraint
424         o -Allow objects to be moved to different schemas
425         o Allow ALTER TABLESPACE to move to different directories
426         o Allow databases to be moved to different tablespaces
427         o Allow moving system tables to other tablespaces, where possible
428
429           Currently non-global system tables must be in the default database
430           tablespace. Global system tables can never be moved.
431
432         o Prevent child tables from altering constraints like CHECK that were
433           inherited from the parent table
434
435
436 * CLUSTER
437
438         o Automatically maintain clustering on a table
439
440           This might require some background daemon to maintain clustering
441           during periods of low usage. It might also require tables to be only
442           paritally filled for easier reorganization.  Another idea would
443           be to create a merged heap/index data file so an index lookup would
444           automatically access the heap data too.  A third idea would be to
445           store heap rows in hashed groups, perhaps using a user-supplied
446           hash function.
447
448         o Add default clustering to system tables
449
450           To do this, determine the ideal cluster index for each system
451           table and set the cluster setting during initdb.
452
453
454 * COPY
455
456         o Allow COPY to report error lines and continue
457
458           This requires the use of a savepoint before each COPY line is
459           processed, with ROLLBACK on COPY failure.
460
461         o -Allow COPY to understand \x as a hex byte
462         o Have COPY return the number of rows loaded/unloaded?
463         o -Allow COPY to optionally include column headings in the first line
464         o -Allow COPY FROM ... CSV to interpret newlines and carriage
465           returns in data
466
467
468 * GRANT/REVOKE
469
470         o Allow column-level privileges
471         o Allow GRANT/REVOKE permissions to be applied to all schema objects
472           with one command
473
474           The proposed syntax is:
475                 GRANT SELECT ON ALL TABLES IN public TO phpuser;
476                 GRANT SELECT ON NEW TABLES IN public TO phpuser;
477
478         * Allow GRANT/REVOKE permissions to be inherited by objects based on
479           schema permissions
480
481
482 * CURSOR
483
484         o Allow UPDATE/DELETE WHERE CURRENT OF cursor
485
486           This requires using the row ctid to map cursor rows back to the
487           original heap row. This become more complicated if WITH HOLD cursors
488           are to be supported because WITH HOLD cursors have a copy of the row
489           and no FOR UPDATE lock.
490
491         o Prevent DROP TABLE from dropping a row referenced by its own open
492           cursor?
493
494         o Allow pooled connections to list all open WITH HOLD cursors
495
496           Because WITH HOLD cursors exist outside transactions, this allows
497           them to be listed so they can be closed.
498
499
500 * INSERT
501
502         o Allow INSERT/UPDATE of the system-generated oid value for a row
503         o Allow INSERT INTO tab (col1, ..) VALUES (val1, ..), (val2, ..)
504         o Allow INSERT/UPDATE ... RETURNING new.col or old.col
505
506           This is useful for returning the auto-generated key for an INSERT.
507           One complication is how to handle rules that run as part of
508           the insert.
509
510
511 * SHOW/SET
512
513         o -Have SHOW ALL show descriptions for server-side variables
514         o Add SET PERFORMANCE_TIPS option to suggest INDEX, VACUUM, VACUUM
515           ANALYZE, and CLUSTER
516         o Add SET PATH for schemas?
517
518           This is basically the same as SET search_path.
519
520
521 * Server-Side Languages
522
523         o -Allow PL/PgSQL's RAISE function to take expressions
524
525           Currently only constants are supported.
526
527         o -Change PL/PgSQL to use palloc() instead of malloc()
528         o Handle references to temporary tables that are created, destroyed,
529           then recreated during a session, and EXECUTE is not used
530
531           This requires the cached PL/PgSQL byte code to be invalidated when
532           an object referenced in the function is changed.
533
534         o Fix PL/pgSQL RENAME to work on variables other than OLD/NEW
535         o Allow function parameters to be passed by name,
536           get_employee_salary(emp_id => 12345, tax_year => 2001)
537         o Add Oracle-style packages
538         o Add table function support to pltcl, plperl, plpython?
539         o Allow PL/pgSQL to name columns by ordinal position, e.g. rec.(3)
540         o -Allow PL/pgSQL EXECUTE query_var INTO record_var;
541         o Add capability to create and call PROCEDURES
542         o Allow PL/pgSQL to handle %TYPE arrays, e.g. tab.col%TYPE[]
543         o Add MOVE to PL/pgSQL
544         o Pass arrays natively instead of as text between plperl and postgres
545         o Add support for polymorphic arguments and return types to plperl
546
547
548 Clients
549 =======
550
551 * Add a libpq function to support Parse/DescribeStatement capability
552 * Prevent libpq's PQfnumber() from lowercasing the column name?
553 * Allow libpq to access SQLSTATE so pg_ctl can test for connection failure
554
555   This would be used for checking if the server is up.
556
557 * Add PQescapeIdentifier() to libpq
558 * Have initdb set DateStyle based on locale?
559 * Have pg_ctl look at PGHOST in case it is a socket directory?
560 * Add a schema option to createlang
561 * Allow pg_ctl to work properly with configuration files located outside
562   the PGDATA directory
563
564   pg_ctl can not read the pid file because it isn't located in the
565   config directory but in the PGDATA directory.  The solution is to
566   allow pg_ctl to read and understand postgresql.conf to find the
567   data_directory value.
568
569
570 * psql
571
572         o Have psql show current values for a sequence
573         o Move psql backslash database information into the backend, use
574           mnemonic commands? [psql]
575
576           This would allow non-psql clients to pull the same information out
577           of the database as psql.
578
579         o Fix psql's display of schema information (Neil)
580         o Allow psql \pset boolean variables to set to fixed values, rather
581           than toggle
582         o Consistently display privilege information for all objects in psql
583         o Improve psql's handling of multi-line queries
584
585
586 * pg_dump
587
588         o Have pg_dump use multi-statement transactions for INSERT dumps
589         o Allow pg_dump to use multiple -t and -n switches [pg_dump]
590         o Add dumping of comments on composite type columns
591         o Add dumping of comments on index columns
592         o Replace crude DELETE FROM method of pg_dumpall --clean for 
593           cleaning of roles with separate DROP commands
594         o -Add dumping and restoring of LOB comments
595         o Stop dumping CASCADE on DROP TYPE commands in clean mode
596         o Add full object name to the tag field.  eg. for operators we need
597           '=(integer, integer)', instead of just '='.
598         o Add pg_dumpall custom format dumps.
599
600           This is probably best done by combining pg_dump and pg_dumpall
601           into a single binary.
602
603         o Add CSV output format
604         o Update pg_dump and psql to use the new COPY libpq API (Christopher)
605         o Remove unnecessary abstractions in pg_dump source code
606
607
608 * ecpg
609
610         o Docs
611
612           Document differences between ecpg and the SQL standard and
613           information about the Informix-compatibility module.
614
615         o Solve cardinality > 1 for input descriptors / variables?
616         o Add a semantic check level, e.g. check if a table really exists
617         o fix handling of DB attributes that are arrays
618         o Use backend PREPARE/EXECUTE facility for ecpg where possible
619         o Implement SQLDA
620         o Fix nested C comments
621         o sqlwarn[6] should be 'W' if the PRECISION or SCALE value specified
622         o Make SET CONNECTION thread-aware, non-standard?
623         o Allow multidimensional arrays
624         o Add internationalized message strings
625
626
627 Referential Integrity
628 =====================
629
630 * Add MATCH PARTIAL referential integrity
631 * Add deferred trigger queue file
632
633   Right now all deferred trigger information is stored in backend
634   memory.  This could exhaust memory for very large trigger queues.
635   This item involves dumping large queues into files.
636
637 * -Implement shared row locks and use them in RI triggers
638 * Change foreign key constraint for array -> element to mean element
639   in array?
640 * Allow DEFERRABLE UNIQUE constraints?
641 * Allow triggers to be disabled [trigger]
642
643   Currently the only way to disable triggers is to modify the system
644   tables.
645
646 * With disabled triggers, allow pg_dump to use ALTER TABLE ADD FOREIGN KEY
647
648   If the dump is known to be valid, allow foreign keys to be added
649   without revalidating the data.
650
651 * Allow statement-level triggers to access modified rows
652 * Support triggers on columns (Greg Sabino Mullane)
653 * Remove CREATE CONSTRAINT TRIGGER
654
655   This was used in older releases to dump referential integrity
656   constraints.
657
658 * Enforce referential integrity for system tables
659 * Allow AFTER triggers on system tables
660
661   System tables are modified in many places in the backend without going
662   through the executor and therefore not causing triggers to fire. To
663   complete this item, the functions that modify system tables will have
664   to fire triggers.
665
666
667 Dependency Checking
668 ===================
669
670 * Flush cached query plans when the dependent objects change
671 * Track dependencies in function bodies and recompile/invalidate
672
673
674 Exotic Features
675 ===============
676
677 * Add SQL99 WITH clause to SELECT
678 * Add SQL99 WITH RECURSIVE to SELECT
679 * Add pre-parsing phase that converts non-ISO syntax to supported
680   syntax
681
682   This could allow SQL written for other databases to run without
683   modification.
684
685 * Allow plug-in modules to emulate features from other databases
686 * SQL*Net listener that makes PostgreSQL appear as an Oracle database
687   to clients
688 * Allow queries across databases or servers with transaction
689   semantics
690
691   This can be done using dblink and two-phase commit.
692
693 * -Add two-phase commit
694
695
696 * Add the features of packages
697
698         o  Make private objects accessable only to objects in the same schema
699         o  Allow current_schema.objname to access current schema objects
700         o  Add session variables
701         o  Allow nested schemas
702
703
704 Indexes
705 =======
706
707 * Allow inherited tables to inherit index, UNIQUE constraint, and primary
708   key, foreign key
709 * UNIQUE INDEX on base column not honored on INSERTs/UPDATEs from
710   inherited table:  INSERT INTO inherit_table (unique_index_col) VALUES
711   (dup) should fail
712
713   The main difficulty with this item is the problem of creating an index
714   that can span more than one table.
715
716 * Allow SELECT ... FOR UPDATE on inherited tables
717 * -Prevent inherited tables from expanding temporary subtables of other
718   sessions
719 * Add UNIQUE capability to non-btree indexes
720 * -Use indexes for MIN() and MAX()
721
722   MIN/MAX queries can already be rewritten as SELECT col FROM tab ORDER
723   BY col {DESC} LIMIT 1. Completing this item involves doing this
724   transformation automatically.
725
726 * -Use index to restrict rows returned by multi-key index when used with
727   non-consecutive keys to reduce heap accesses
728
729   For an index on col1,col2,col3, and a WHERE clause of col1 = 5 and
730   col3 = 9, spin though the index checking for col1 and col3 matches,
731   rather than just col1; also called skip-scanning.
732
733 * Prevent index uniqueness checks when UPDATE does not modify the column
734
735   Uniqueness (index) checks are done when updating a column even if the
736   column is not modified by the UPDATE.
737
738 * Fetch heap pages matching index entries in sequential order
739
740   Rather than randomly accessing heap pages based on index entries, mark
741   heap pages needing access in a bitmap and do the lookups in sequential
742   order. Another method would be to sort heap ctids matching the index
743   before accessing the heap rows.
744
745 * -Allow non-bitmap indexes to be combined by creating bitmaps in memory
746
747   This feature allows separate indexes to be ANDed or ORed together.  This
748   is particularly useful for data warehousing applications that need to
749   query the database in an many permutations.  This feature scans an index
750   and creates an in-memory bitmap, and allows that bitmap to be combined
751   with other bitmap created in a similar way.  The bitmap can either index
752   all TIDs, or be lossy, meaning it records just page numbers and each
753   page tuple has to be checked for validity in a separate pass.
754
755 * Allow the creation of on-disk bitmap indexes which can be quickly
756   combined with other bitmap indexes
757
758   Such indexes could be more compact if there are only a few distinct values.
759   Such indexes can also be compressed.  Keeping such indexes updated can be
760   costly.
761
762 * Allow use of indexes to search for NULLs
763
764   One solution is to create a partial index on an IS NULL expression.
765
766 * Allow accurate statistics to be collected on indexes with more than
767   one column or expression indexes, perhaps using per-index statistics
768 * Add fillfactor to control reserved free space during index creation
769 * Allow the creation of indexes with mixed ascending/descending specifiers
770 * -Fix incorrect rtree results due to wrong assumptions about "over"
771   operator semantics
772 * Allow constraint_exclusion to work for UNIONs like it does for
773   inheritance, and allow it to work for UPDATE and DELETE queries
774
775
776 * GIST
777
778         o Add more GIST index support for geometric data types
779         o -Add concurrency to GIST
780         o Allow GIST indexes to create certain complex index types, like
781           digital trees (see Aoki)
782
783 * Hash
784
785         o Pack hash index buckets onto disk pages more efficiently
786
787           Currently no only one hash bucket can be stored on a page. Ideally
788           several hash buckets could be stored on a single page and greater
789           granularity used for the hash algorithm.
790
791         o Consider sorting hash buckets so entries can be found using a
792           binary search, rather than a linear scan
793
794         o In hash indexes, consider storing the hash value with or instead
795           of the key itself
796
797
798 Fsync
799 =====
800
801 * Improve commit_delay handling to reduce fsync()
802 * Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options
803 * -Allow multiple blocks to be written to WAL with one write()
804 * Add an option to sync() before fsync()'ing checkpoint files
805 * Add program to test if fsync has a delay compared to non-fsync
806
807
808 Cache Usage
809 ===========
810
811 * Allow free-behind capability for large sequential scans, perhaps using
812   posix_fadvise()
813
814   Posix_fadvise() can control both sequential/random file caching and
815   free-behind behavior, but it is unclear how the setting affects other
816   backends that also have the file open, and the feature is not supported
817   on all operating systems.
818
819 * -Consider use of open/fcntl(O_DIRECT) to minimize OS caching,
820   for WAL writes
821
822   O_DIRECT doesn't have the same media write guarantees as fsync, so it
823   is in addition to the fsync method, not in place of it.
824
825 * -Cache last known per-tuple offsets to speed long tuple access
826 * Speed up COUNT(*)
827
828   We could use a fixed row count and a +/- count to follow MVCC
829   visibility rules, or a single cached value could be used and
830   invalidated if anyone modifies the table.  Another idea is to
831   get a count directly from a unique index, but for this to be
832   faster than a sequential scan it must avoid access to the heap
833   to obtain tuple visibility information.
834
835 * Allow data to be pulled directly from indexes
836
837   Currently indexes do not have enough tuple visibility information 
838   to allow data to be pulled from the index without also accessing 
839   the heap.  One way to allow this is to set a bit to index tuples 
840   to indicate if a tuple is currently visible to all transactions 
841   when the first valid heap lookup happens.  This bit would have to 
842   be cleared when a heap tuple is expired.
843
844
845 * Consider automatic caching of queries at various levels:
846
847         o Parsed query tree
848         o Query execute plan
849         o Query results
850
851 * -Allow the size of the buffer cache used by temporary objects to be
852   specified as a GUC variable
853
854   Larger local buffer cache sizes requires more efficient handling of
855   local cache lookups.
856
857 * Improve the background writer
858
859   Allow the background writer to more efficiently write dirty buffers
860   from the end of the LRU cache and use a clock sweep algorithm to
861   write other dirty buffers to reduced checkpoint I/O
862
863 * Allow sequential scans to take advantage of other concurrent
864   sequentiqal scans, also called "Synchronised Scanning"
865
866   One possible implementation is to start sequential scans from the lowest
867   numbered buffer in the shared cache, and when reaching the end wrap
868   around to the beginning, rather than always starting sequential scans
869   at the start of the table.
870
871
872 Vacuum
873 ======
874
875 * Improve speed with indexes
876
877   For large table adjustements during vacuum, it is faster to reindex
878   rather than update the index.
879
880 * Reduce lock time by moving tuples with read lock, then write
881   lock and truncate table
882
883   Moved tuples are invisible to other backends so they don't require a
884   write lock. However, the read lock promotion to write lock could lead
885   to deadlock situations.
886
887 * -Add a warning when the free space map is too small
888 * Maintain a map of recently-expired rows
889
890   This allows vacuum to target specific pages for possible free space 
891   without requiring a sequential scan.
892
893 * Auto-fill the free space map by scanning the buffer cache or by
894   checking pages written by the background writer
895 * Create a bitmap of pages that need vacuuming
896
897   Instead of sequentially scanning the entire table, have the background
898   writer or some other process record pages that have expired rows, then
899   VACUUM can look at just those pages rather than the entire table.  In
900   the event of a system crash, the bitmap would probably be invalidated.
901
902 * Add system view to show free space map contents
903
904
905 * Auto-vacuum
906
907         o -Move into the backend code
908         o Use free-space map information to guide refilling
909         o Do VACUUM FULL if table is nearly empty?
910         o Improve xid wraparound detection by recording per-table rather
911           than per-database
912
913
914 Locking
915 =======
916
917 * -Make locking of shared data structures more fine-grained
918
919   This requires that more locks be acquired but this would reduce lock
920   contention, improving concurrency.
921
922 * Add code to detect an SMP machine and handle spinlocks accordingly
923   from distributted.net, http://www1.distributed.net/source,
924   in client/common/cpucheck.cpp
925
926   On SMP machines, it is possible that locks might be released shortly,
927   while on non-SMP machines, the backend should sleep so the process
928   holding the lock can complete and release it.
929
930 * -Improve SMP performance on i386 machines
931
932   i386-based SMP machines can generate excessive context switching
933   caused by lock failure in high concurrency situations. This may be
934   caused by CPU cache line invalidation inefficiencies.
935
936 * Research use of sched_yield() for spinlock acquisition failure
937 * Fix priority ordering of read and write light-weight locks (Neil)
938
939
940 Startup Time Improvements
941 =========================
942
943 * Experiment with multi-threaded backend [thread]
944
945   This would prevent the overhead associated with process creation. Most
946   operating systems have trivial process creation time compared to
947   database startup overhead, but a few operating systems (WIn32,
948   Solaris) might benefit from threading.  Also explore the idea of
949   a single session using multiple threads to execute a query faster.
950
951 * Add connection pooling
952
953   It is unclear if this should be done inside the backend code or done
954   by something external like pgpool. The passing of file descriptors to
955   existing backends is one of the difficulties with a backend approach.
956
957
958 Write-Ahead Log
959 ===============
960
961 * Eliminate need to write full pages to WAL before page modification [wal]
962
963   Currently, to protect against partial disk page writes, we write
964   full page images to WAL before they are modified so we can correct any
965   partial page writes during recovery.  These pages can also be
966   eliminated from point-in-time archive files.
967
968         o  -Add ability to turn off full page writes
969         o  When off, write CRC to WAL and check file system blocks
970            on recovery
971
972            If CRC check fails during recovery, remember the page in case
973            a later CRC for that page properly matches.
974
975         o  Write full pages during file system write and not when
976            the page is modified in the buffer cache
977
978            This allows most full page writes to happen in the background
979            writer.  It might cause problems for applying WAL on recovery
980            into a partially-written page, but later the full page will be
981            replaced from WAL.
982
983 * Reduce WAL traffic so only modified values are written rather than
984   entire rows?
985 * Add WAL index reliability improvement to non-btree indexes
986 * Allow the pg_xlog directory location to be specified during initdb
987   with a symlink back to the /data location
988 * Allow WAL information to recover corrupted pg_controldata
989 * Find a way to reduce rotational delay when repeatedly writing
990   last WAL page
991
992   Currently fsync of WAL requires the disk platter to perform a full
993   rotation to fsync again. One idea is to write the WAL to different
994   offsets that might reduce the rotational delay.
995
996 * Allow buffered WAL writes and fsync
997
998   Instead of guaranteeing recovery of all committed transactions, this
999   would provide improved performance by delaying WAL writes and fsync
1000   so an abrupt operating system restart might lose a few seconds of
1001   committed transactions but still be consistent.  We could perhaps
1002   remove the 'fsync' parameter (which results in an an inconsistent
1003   database) in favor of this capability.
1004
1005 * -Eliminate WAL logging for CREATE TABLE AS when not doing WAL archiving
1006 * -Change WAL to use 32-bit CRC, for performance reasons
1007
1008
1009 Optimizer / Executor
1010 ====================
1011
1012 * Add missing optimizer selectivities for date, r-tree, etc
1013 * Allow ORDER BY ... LIMIT # to select high/low value without sort or
1014   index using a sequential scan for highest/lowest values
1015
1016   Right now, if no index exists, ORDER BY ... LIMIT # requires we sort
1017   all values to return the high/low value.  Instead The idea is to do a 
1018   sequential scan to find the high/low value, thus avoiding the sort.
1019   MIN/MAX already does this, but not for LIMIT > 1.
1020
1021 * Precompile SQL functions to avoid overhead
1022 * Create utility to compute accurate random_page_cost value
1023 * Improve ability to display optimizer analysis using OPTIMIZER_DEBUG
1024 * Have EXPLAIN ANALYZE highlight poor optimizer estimates
1025 * -Use CHECK constraints to influence optimizer decisions
1026
1027   CHECK constraints contain information about the distribution of values
1028   within the table. This is also useful for implementing subtables where
1029   a tables content is distributed across several subtables.
1030
1031 * Consider using hash buckets to do DISTINCT, rather than sorting
1032
1033   This would be beneficial when there are few distinct values.
1034
1035 * ANALYZE should record a pg_statistic entry for an all-NULL column
1036 * Log queries where the optimizer row estimates were dramatically
1037   different from the number of rows actually found?
1038
1039
1040 Miscellaneous Performance
1041 =========================
1042
1043 * Do async I/O for faster random read-ahead of data
1044
1045   Async I/O allows multiple I/O requests to be sent to the disk with
1046   results coming back asynchronously.
1047
1048 * Use mmap() rather than SYSV shared memory or to write WAL files?
1049
1050   This would remove the requirement for SYSV SHM but would introduce
1051   portability issues. Anonymous mmap (or mmap to /dev/zero) is required
1052   to prevent I/O overhead.
1053
1054 * Consider mmap()'ing files into a backend?
1055
1056   Doing I/O to large tables would consume a lot of address space or
1057   require frequent mapping/unmapping.  Extending the file also causes
1058   mapping problems that might require mapping only individual pages,
1059   leading to thousands of mappings.  Another problem is that there is no
1060   way to _prevent_ I/O to disk from the dirty shared buffers so changes
1061   could hit disk before WAL is written.
1062
1063 * Add a script to ask system configuration questions and tune postgresql.conf
1064 * Use a phantom command counter for nested subtransactions to reduce
1065   per-tuple overhead
1066 * Research storing disk pages with no alignment/padding
1067
1068 Source Code
1069 ===========
1070
1071 * Add use of 'const' for variables in source tree
1072 * Rename some /contrib modules from pg* to pg_*
1073 * Move some things from /contrib into main tree
1074 * Move some /contrib modules out to their own project sites
1075 * Remove warnings created by -Wcast-align
1076 * Move platform-specific ps status display info from ps_status.c to ports
1077 * Add optional CRC checksum to heap and index pages
1078 * Improve documentation to build only interfaces (Marc)
1079 * Remove or relicense modules that are not under the BSD license, if possible
1080 * Remove memory/file descriptor freeing before ereport(ERROR)
1081 * Acquire lock on a relation before building a relcache entry for it
1082 * Promote debug_query_string into a server-side function current_query()
1083 * Allow the identifier length to be increased via a configure option
1084 * Remove Win32 rename/unlink looping if unnecessary
1085 * -Remove kerberos4 from source tree
1086 * Allow cross-compiling by generating the zic database on the target system
1087 * Improve NLS maintenace of libpgport messages linked onto applications
1088 * Allow ecpg to work with MSVC and BCC
1089 * -Make src/port/snprintf.c thread-safe
1090 * Add xpath_array() to /contrib/xml2 to return results as an array
1091 * Allow building in directories containing spaces
1092
1093   This is probably not possible because 'gmake' and other compiler tools
1094   do not fully support quoting of paths with spaces.
1095
1096 * Allow installing to directories containing spaces
1097
1098   This is possible if proper quoting is added to the makefiles for the
1099   install targets.  Because PostgreSQL supports relocatable installs, it
1100   is already possible to install into a directory that doesn't contain 
1101   spaces and then copy the install to a directory with spaces.
1102
1103 * Fix cross-compiling of time zone database via 'zic'
1104 * Fix sgmltools so PDFs can be generated with bookmarks
1105 * -Add C code on Unix to copy directories for use in creating new databases
1106
1107
1108 * Win32
1109
1110         o Remove configure.in check for link failure when cause is found
1111         o Remove readdir() errno patch when runtime/mingwex/dirent.c rev
1112           1.4 is released
1113         o Remove psql newline patch when we find out why mingw outputs an
1114           extra newline
1115         o Allow psql to use readline once non-US code pages work with
1116           backslashes
1117         o Re-enable timezone output on log_line_prefix '%t' when a
1118           shorter timezone string is available
1119         o Improve dlerror() reporting string
1120         o Fix problem with shared memory on the Win32 Terminal Server
1121         o Add support for Unicode
1122
1123           To fix this, the data needs to be converted to/from UTF16/UTF8
1124           so the Win32 wcscoll() can be used, and perhaps other functions
1125           like towupper().  However, UTF8 already works with normal
1126           locales but provides no ordering or character set classes.
1127
1128
1129 * Wire Protocol Changes
1130
1131         o Allow dynamic character set handling
1132         o Add decoded type, length, precision
1133         o Use compression?
1134         o Update clients to use data types, typmod, schema.table.column names
1135           of result sets using new query protocol
1136
1137
1138 ---------------------------------------------------------------------------
1139
1140
1141 Developers who have claimed items are:
1142 --------------------------------------
1143 * Alvaro is Alvaro Herrera <alvherre@dcc.uchile.cl>
1144 * Andrew is Andrew Dunstan <andrew@dunslane.net>
1145 * Bruce is Bruce Momjian <pgman@candle.pha.pa.us> of Software Research Assoc.
1146 * Christopher is Christopher Kings-Lynne <chriskl@familyhealth.com.au> of
1147     Family Health Network
1148 * Claudio is Claudio Natoli <claudio.natoli@memetrics.com>
1149 * D'Arcy is D'Arcy J.M. Cain <darcy@druid.net> of The Cain Gang Ltd.
1150 * Fabien is Fabien Coelho <coelho@cri.ensmp.fr>
1151 * Gavin is Gavin Sherry <swm@linuxworld.com.au> of Alcove Systems Engineering
1152 * Greg is Greg Sabino Mullane <greg@turnstep.com>
1153 * Hiroshi is Hiroshi Inoue <Inoue@tpf.co.jp>
1154 * Jan is Jan Wieck <JanWieck@Yahoo.com> of Afilias, Inc.
1155 * Joe is Joe Conway <mail@joeconway.com>
1156 * Karel is Karel Zak <zakkr@zf.jcu.cz>
1157 * Magnus is Magnus Hagander <mha@sollentuna.net>
1158 * Marc is Marc Fournier <scrappy@hub.org> of PostgreSQL, Inc.
1159 * Matthew T. O'Connor <matthew@zeut.net>
1160 * Michael is Michael Meskes <meskes@postgresql.org> of Credativ
1161 * Neil is Neil Conway <neilc@samurai.com>
1162 * Oleg is Oleg Bartunov <oleg@sai.msu.su>
1163 * Peter is Peter Eisentraut <peter_e@gmx.net>
1164 * Philip is Philip Warner <pjw@rhyme.com.au> of Albatross Consulting Pty. Ltd.
1165 * Rod is Rod Taylor <pg@rbt.ca>
1166 * Simon is Simon Riggs <simon@2ndquadrant.com>
1167 * Stephan is Stephan Szabo <sszabo@megazone23.bigpanda.com>
1168 * Tatsuo is Tatsuo Ishii <t-ishii@sra.co.jp> of Software Research Assoc.
1169 * Tom is Tom Lane <tgl@sss.pgh.pa.us> of Red Hat