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