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