On Apr 4, 2005 11:52 AM, Tom Lane <[EMAIL PROTECTED]> wrote:
> Christopher Petrilli <[EMAIL PROTECTED]> writes:
> > The table has:
> >     * 21 columns (nothing too strange)
> >     * No OIDS
> >     * 5 indexes, including the primary key on a string
> Could we see the *exact* SQL definitions of the table and indexes?
> Also some sample data would be interesting.  I'm wondering for example
> about the incidence of duplicate index keys.

Of course, this is a bit cleansed, since it's an internal project, but
only the column names are changed:

    foo_id              VARCHAR(32),
    s_ts                INTEGER NOT NULL,
    c_ts                INTEGER NOT NULL,
    bar_id              INTEGER NOT NULL,
    proto               INTEGER NOT NULL,
    src_ip              INT8 NOT NULL,
    dst_ip              INT8 NOT NULL,
    src_port            INTEGER,
    dst_port            INTEGER,
    nated               INTEGER NOT NULL,
    src_nat_ip          INT8,
    dst_nat_ip          INT8,
    src_nat_port        INTEGER,
    dst_nat_port        INTEGER,
    foo_class           INTEGER NOT NULL,
    foo_type            INTEGER NOT NULL,
    src_bar             INTEGER NOT NULL,
    dst_bar             INTEGER NOT NULL,
    user_name           VARCHAR(255),
    info                TEXT
ALTER TABLE foos ADD CONSTRAINT foos_foo_id_pk UNIQUE (foo_id);
CREATE INDEX foos_c_ts_idx ON foos(conduit_ts);
CREATE INDEX foos_src_ip_idx ON foos(src_ip);
CREATE INDEX foos_dst_ip_idx ON foos(dst_ip);
CREATE INDEX foos_foo_class_idx ON foos(foo_class);
CREATE INDEX foos_foo_type_idx ON foos(foo_type);

ALTER TABLE foos001 ADD CONSTRAINT foos001_foo_id_pk UNIQUE (foo_id);
CREATE INDEX foos001_c_ts_idx ON foos001(conduit_ts);
CREATE INDEX foos001_src_ip_idx ON foos001(src_ip);
CREATE INDEX foos001_dst_ip_idx ON foos001(dst_ip);
CREATE INDEX foos001_foo_class_idx ON foos001(foo_class);
CREATE INDEX foos001_foo_type_idx ON foos001(foo_type);

That continues on, but you get the idea...

So, as you asked about data content, specifically regarding indices,
here's what the "simulator" creates:

foo_id - 32 character UID (generated by the UUID function in mxTools,
which looks like '00beef19420053c64f3f01aeb0b4a2a5', and varies in the
upper components more than the lower.

*_ts - UNIX epoch timestamps, sequential.  There's a long story behind
not using DATETIME format, but if that's the big issue, it can be
dealt with.

*_ip - Randomly selected 32-bit integers from a pre-generated list
containing about 500 different numbers ranging from 3232235500 to
3232236031. This is unfortunately, not too atypical from the "real

*_class - Randomly selected 1-100 (again, not atypical, although
normal distribution would be less random)

*_type - Randomly selected 1-10000 (not atypical, and more random than
in real world)

Hopefully this helps? 

| Christopher Petrilli

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to